Splunk Search

I want to pick up values from different columns from lookup files according to the sourcetype.

veerendra_modi
Loves-to-Learn

I want to pick up values from different lookup files according to the sourcetype.
| lookup error_rules.csv EventSubType Criticality OUTPUT wait_time threshold_count window_limit

Say i have two source type 1 and type2

For type1 i want to lookup EventSubType and Criticality_type1 in lookup error_rules.csv
For type2 i want to lookup EventSubType and Criticality_type2 in lookup error_rules.csv

Please suggest the solution for this scenario if case needs to be used let me know how it will be implemented.

Tags (2)
0 Karma

woodcock
Esteemed Legend

Like this:

... | eval Criticality = if(sourceype="type1", Criticality_type1, Criticality_type2)
| lookup error_rules.csv EventSubType Criticality OUTPUT wait_time threshold_count window_limit
| fields - Criticality
0 Karma

woodcock
Esteemed Legend

Just add sourcetype to your lookup file.

0 Karma

adonio
Ultra Champion

not sure i fully understand, but how about something along those lines:

 ... your search ... (sourcetype=1 OR sourcetype=2) ... | lookup error_rules.csv EventSubType Criticality OUTPUT wait_time threshold_count window_limit
| eval Criticality_type1= if(sourcetype=="1",Criticality,null())
| eval Criticality_type2= if(sourcetype=="2",Criticality,null())
| .... more stuff if you want 
0 Karma
Get Updates on the Splunk Community!

Infographic provides the TL;DR for the 2023 Splunk Career Impact Report

We’ve been shouting it from the rooftops! The findings from the 2023 Splunk Career Impact Report showing that ...

Splunk Lantern | Getting Started with Edge Processor, Machine Learning Toolkit ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...