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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...