Splunk Search

I require rex which stops search on first match of word in string.

shukan
Explorer

I have below raw text.
\"LDCAccountNumber\":\"4346780895\",\"BudgetBilling\":\"N\",\"TaxExempt\":\"N\",{\"field\":\"BudgetBilling\",

I have created rex ( rex "LDCAccountNumber(?[^*]*)BudgetBilling") to take value between LDCAccountNumber and BudgetBilling. but BudgetBilling is repeating word in the string so getting wrong result.
Currnent output :\"4346780895\",\"BudgetBilling\":\"N\",\"TaxExempt\":\"N\",{\"field\"
required output : 4346780895

it should stop on first match word.

Thanks in advance.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi shukan,
I don't understand if backslashes in the string of your message are in your log or it's a visualization problem.
Anyway, if your log is with backslashes, try this regex

LDCAccountNumber\\\":\\\"(?<LDCAccountNumber>\d+)\\\",\\\"BudgetBilling

If otherwise, your log is without backslashes try the following regex

LDCAccountNumber\":\"(?<LDCAccountNumber>\d+)\",\"BudgetBilling

You can test it at https://regex101.com/r/RcXlxa/1
Bye.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...