Splunk Search

How to use rex command to extract this field from my sample log?

Abilan1
Path Finder

Hi ,

COSE#1017 Associated kernel not found. Please see Enterprise Server log for details: SocID:19041 PID:13695 BSFN:CustomShipConfirmWrapper user:AIAINBND

I want to create that highlighted term as a new event field. It may vary in length in following events. Could anyone help me?

Thanks

0 Karma
1 Solution

MuS
Legend

Hi Abilan1,

try something like this, which is based on your provided example:

your base search here | rex "\sBSFN:(?<myField>[^\s]*)" | table myField

cheers, MuS

View solution in original post

Richfez
SplunkTrust
SplunkTrust

If BSFN is a constant, which it appears to be, something as simple as

 ... | rex "BSFN:(?<GiveMeAName>\w+)"

That says

BSFN: Match the string "BSFN:" (including the colon)

(? Then extract a field named "GiveMeAName"

\w+ Which consists of one or more "word" type characters (letters)

) And finally close off this extraction.

Abilan1
Path Finder

Thank You rich!!! it worked

0 Karma

MuS
Legend

Hi Abilan1,

try something like this, which is based on your provided example:

your base search here | rex "\sBSFN:(?<myField>[^\s]*)" | table myField

cheers, MuS

Abilan1
Path Finder

Thank You MuS!!

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 ...