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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...