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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...