Knowledge Management

problem extracting empty values

Be_JAR
Path Finder

Hi all,

I am ingesting data and I have  a problem :

event example:
field1 = /var/log/asas/log1.log
field2 = /var/log/as/as/log2.log
field3 = /var/log/as/as/log3.log

in the sourcetype (props.conf) I do it like this:
^.*field1 \=\s*(?<log1>.*?)\s*\n
^.*field2 \=\s*(?<log2>.*?)\s*\n
^.*field3 \=\s*(?<log3>.*?)\s*\n

The problem is when the value of some field appears empty. In that case capture the following line. like this:

source:
field1 = /var/log/as/as/log1.log
field2 = 
field3 = /var/log/log/as/log3.log

result:
log2= field3 = /var/log/logs/log3.log

 

I'm sure there is a way to fix it and make the field appear empty, but I can't find it. Does anyone know how to do it?

 

BR

JAR

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

(?m)^.*field1 \=\s*(?<log1>\S*?)\s*\n
(?m)^.*field2 \=\s*(?<log2>\S*?)\s*\n
(?m)^.*field3 \=\s*(?<log3>\S*?)\s*\n

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

(?m)^.*field1 \=\s*(?<log1>\S*?)\s*\n
(?m)^.*field2 \=\s*(?<log2>\S*?)\s*\n
(?m)^.*field3 \=\s*(?<log3>\S*?)\s*\n
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...