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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...