Splunk Search

lookup setup for regex extracted value

sumitnagal
Path Finder

I have a extracted value from log, puserid. now I have map that Id to a user in lookup table. now when I am applying the lookup table I am not getting any results. even after configuring lookup table correctly

Example :

 "some search string" | rex field=_raw " (?<uri>[^ ]*) (?<primary>[A-Za-z]*) (?<puserid>[^ ]*) (?<puri>[^ ]*) " | stats count by puserid

Lookup Mapping, after defining table and definition and automatic setup:

 puserid,plogin
 1234,test

After lookup setup:

 "some search string" | rex field=_raw " (?<uri>[^ ]*) (?<primary>[A-Za-z]*) (?<puserid>[^ ]*) (?<puri>[^ ]*) " | stats count by plogin
Tags (3)
0 Karma
1 Solution

araitz
Splunk Employee
Splunk Employee

Keep in mind that lookups are automatically applied at the first pipe in the search string.

Therefore, you can either make the field extraction persistent using props.conf and transforms.conf or force the lookup to run after your rex command.

Assuming you have defined your lookup as foo_lookup:

"some search string" | rex field=_raw " (?<uri>[^ ]*) (?<primary>[A-Za-z]*) (?<puserid>[^ ]*) (?<puri>[^ ]*) " | lookup foo_lookup puserid OUTPUTNEW | stats count by plogin

View solution in original post

araitz
Splunk Employee
Splunk Employee

Keep in mind that lookups are automatically applied at the first pipe in the search string.

Therefore, you can either make the field extraction persistent using props.conf and transforms.conf or force the lookup to run after your rex command.

Assuming you have defined your lookup as foo_lookup:

"some search string" | rex field=_raw " (?<uri>[^ ]*) (?<primary>[A-Za-z]*) (?<puserid>[^ ]*) (?<puri>[^ ]*) " | lookup foo_lookup puserid OUTPUTNEW | stats count by plogin
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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