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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...