Splunk Enterprise

Field extraction does not work when the second field is empty

asharmaeqfx
Path Finder

Hi Splunkers,

 

I have set up a field extractor and it does not work when the log entry is empty. For e.g

Field extraction syntax is

---------------------------

(?:[^=\n]*=){9}"(?P<frontEndLatency>\d+)"\s+\w+="(?P<backEndLatency>\d+)

--------------------------

Log messages

---------------------

blah blah contentType="text/xml" frontEndLatency="587" backEndLatency="391" messages= blah

---------------

It extracts correctly  frontEndLatency="587" and backEndLatency="391"

If somehow in the log file one of the field is empty, it does not extracts properly

Log Messages

-------------

 blah blah contentType="text/xml" frontEndLatency="1795" backEndLatency="" messages= blah blah

--------------

How to set this up or handle it via field extraction? Your help is much appreciated.

Thanks,

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Change this part of the regex

(?P<backEndLatency>\d+)

to

(?P<backEndLatency>\d*)

 The "+" means at least 1 which doesn't match your failing example, "*" means any number including zero which does match your example

View solution in original post

0 Karma

asharmaeqfx
Path Finder

Thanks ITWhisperer

It is working fine. I applied it last tuesday and it works like a charm.

 

Appreciate it.

Thanks,
Amit

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Change this part of the regex

(?P<backEndLatency>\d+)

to

(?P<backEndLatency>\d*)

 The "+" means at least 1 which doesn't match your failing example, "*" means any number including zero which does match your example

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

ATTENTION: We’re Moving! (AGAIN!)

The Splunk Community Slack is undergoing a system migration to keep our workspace secure and ...

Deep Dive: Optimizing Telemetry Pipelines in Splunk Observability Cloud

In this session, we will peel back the layers of Splunk Observability Cloud’s cost-optimization features. ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...