Splunk Search

How can I iterate through an inputlookup?

ddrillic
Ultra Champion

I have the following query -

index=_internal         

host =  <host1> OR
host =  <host2> OR
host =  <host3>


| table _time host | dedup host             
| sort host

I would like to run this commmand via a inputlookup. So, I created this lookup and | inputlookup hosts_05_25_18 shows the host names.

How can I run the above query using this inputlookup?

Similar to the case at inputlookup - How to search through all lookup fields

Tags (2)
1 Solution

jkat54
SplunkTrust
SplunkTrust
  index=yourIndex  [ | inputlookup lookupname | format ]

View solution in original post

0 Karma

ddrillic
Ultra Champion

It's good to have here a reference to this masterpiece answer by @acharlieh - What is the basic difference between the lookup, inputlook and outputlookup commands

0 Karma

jkat54
SplunkTrust
SplunkTrust
  index=yourIndex  [ | inputlookup lookupname | format ]
0 Karma

ddrillic
Ultra Champion

Great @jkat54, and if the host is named differently in the inputlookup?

jkat54
SplunkTrust
SplunkTrust

Sure, try something like this

| inputlookup lookupname | eval host=‘*’.fieldFromLookup.’*’ | format

This would add wildcards around the field value before returning to the root search

ddrillic
Ultra Champion

For the record, eval host=host + "*" worked to include hosts with domain names...

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...