Getting Data In

Replace before importing the data in splunk

abhayneilam
Contributor

Hi,
I have a file which contains the below content:

abhay|vikram|singh|26|kolkata
murari|kumar|singh|28|mumbai

I want to replace "|" to "\ |" before importing to the splunk, I have heard that it is possible if I write it in props.conf but it is not working, Kindly suggest me how to solve this problem as this is needed in urgent basis

Thanks in advance

Tags (3)
0 Karma

lrhazi
Path Finder

Ayn
Legend

You're trying to solve the wrong problem. The real problem is why your delimiters aren't working as they should.

smolcj
Builder

i have the same problem, how to replace \ with \\ while searching?
thankyou for ur time

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

Unclear to me why you want to do this, or why this would be helpful to you after the data has been imported.

lrhazi
Path Finder

What is "haha" ?
also, try and add a back slash "\" before the first pipe character in the sed command. this forum seems to remove my backslashes:

SEDCMD-dekh=s/|/ |/g

0 Karma

abhayneilam
Contributor

[haha]
SHOULD_LINEMERGE = False
SEDCMD-dekh=s/|/ |/g
REPORT-dekh=dekhbhai

this is my props.conf but it is not working properly

0 Karma

lrhazi
Path Finder

That should be:

[source::.../abc.log]
SEDCMD-abc = s/|/ |/g

s for substitute, and g for global, replace all occurrences, not just the first.

0 Karma

lrhazi
Path Finder

The page linked before shows really examples. No?

You should show the relevant part of your props.conf so people can help you.

I have not used this before, but I would try something like:

[source::.../abc.log]
SEDCMD-abc = y/|/ |/

That's trying to say: replace any "|" with " |"

0 Karma

abhayneilam
Contributor

I am trying to use in props.conf but it is not working kindly help me out with some real example

Thanks for your help

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...