Splunk Search

Unable to get the lookup values on the search queries

Nagalakshmi
Path Finder

Hi Team,

Need your assistant for below 

 

We have created new csv lookup and we are using the below query but we are getting  all the data from the index & sourcetype . we need to get the events only for the hosts which mentioned on the lookup is the requirement

Lookup name : Palo_devices.csv, used only one column called Hostname

index=security host=abc sourcetype = Palo

|lookup Palo_devices.CSV Hostname OUTPUT Hostname

 

Regards,

Nagalakshmi 

Labels (1)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @Nagalakshmi ,

you can use your search only if in the main search you have the field youused as key (in your case "Hostname"), have you this field in the main search?

Anyway, if you want to filter the results of a search for the results of a lookup, you have to use a subsearch like the following, putting attention that the field name in main and sub search is the same.

So if in the lookup ho have a column called Hostname and in the main search there's a field called Hostname, you can run something like this:

index=security host=abc sourcetype = Palo [ | inputlookup Palo_devices.CSV | fields Hostname ]
| ...

 Ciao.

Giuseppe

View solution in original post

Nagalakshmi
Path Finder

Hi @gcusello ,

Yes, Hostname field is already exists in the event. Thank you for quick response! Mentioned query is a perfect solution for this issue.

 

Regards,

Nagalakshmi A

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Nagalakshmi ,

you can use your search only if in the main search you have the field youused as key (in your case "Hostname"), have you this field in the main search?

Anyway, if you want to filter the results of a search for the results of a lookup, you have to use a subsearch like the following, putting attention that the field name in main and sub search is the same.

So if in the lookup ho have a column called Hostname and in the main search there's a field called Hostname, you can run something like this:

index=security host=abc sourcetype = Palo [ | inputlookup Palo_devices.CSV | fields Hostname ]
| ...

 Ciao.

Giuseppe

Get Updates on the Splunk Community!

Fall Into Learning with New Splunk Education Courses

Every month, Splunk Education releases new courses to help you branch out, strengthen your data science roots, ...

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...