Splunk Search

Why won't my regular expression extract fields when the _raw field is greater than 56kb?

bitfhacker
New Member

Hi,

I'm trying to extract two fields with this regular expression:

Transaction\sID=\"(?P<Transaction_ID>\w*)\".*OperationCode=\"(?P<Transaction_OperationCode>\w*)\"

and it works in almost all records but it seems that when the _raw field is greater than 56kb, the regular expression doesn't work.

Any clue?

0 Karma

DalJeanis
SplunkTrust
SplunkTrust

Probably reaching catastrophic backtracking because of the greedy .* before "OperationCode=". That is going to take everything in the entire 56K until it hits the end, then back up and look for the very last place it finds "OperationCode=" before the end. Sometimes you want that behavior, but not in this case.

Instead, you want it to be lazy, and stop slurping its soup the first time it encounters "OperationCode=".

Change that middle snippet to this... we're just adding a question mark to make the .* before "OperationCode=" become "lazy" instead of "greedy".

\".*?OperationCode=\"
0 Karma

asimagu
Builder

are you able to provide a sample for the not working ones?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...