Splunk Search

Use Lookup To Filter Events

HeinzWaescher
Motivator

Hi,

in my searches I want to filter my events when the field "Version" has specific values. The list of values I want to include in the searches will increase over time and would it be nice to have an ease way to handle this, instead of adjusting all searches everytime.

Is it possible to use a lookuptable in the a search to achieve this? So that I will just have to adjust the lookuptable to define the filter for my needed "Versions".

Thanks in advance

Heinz

Tags (2)
1 Solution

Damien_Dallimor
Ultra Champion

You could use the inputlookup command to do this.

So you might have a lookup file called versions.csv

Version
1.0
2.0
3.0

And then you can use a search like :

<search terms> [ | inputlookup <your lookup> ]

index=foo sourcetype=goo [ | inputlookup versions | fields Version ]

View solution in original post

bagarwal
Path Finder

Hi @Damien Dallimore [Splunk],

I tried for similar outcome to search my query ; however no result is found.
Note: In my .csv file there is only one column and it looks like below:
Application
abc*
xyz*
aaa* n so on.

Query is
index="index_name" [ | inputlookup "filename" | fields Application ] | table field1, field2

Anything I am missing. Kindly help.

Thanks & Regards,
Binay Agarwal

0 Karma

Damien_Dallimor
Ultra Champion

You could use the inputlookup command to do this.

So you might have a lookup file called versions.csv

Version
1.0
2.0
3.0

And then you can use a search like :

<search terms> [ | inputlookup <your lookup> ]

index=foo sourcetype=goo [ | inputlookup versions | fields Version ]

HeinzWaescher
Motivator

Ok, that's nice. Thanks a lot for your help!

0 Karma

Damien_Dallimor
Ultra Champion

Exact matches. So your lookup file will need all the versions explictly entered.

0 Karma

HeinzWaescher
Motivator

Hi,

thanks, that's a way I was looking for 🙂
Will this kind of command filter exact matches of the fieldvalue? Or will the output include a Version 1.0.1 as well, when your example above is used?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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