Splunk Search

Using a lookup to grab a host's subnet and then list out all other hosts in that subnet.

pkeller
Contributor

I have a lookup table that includes fields for hostname and subnet. I can easily view all hosts in a subnet by searching: |inputlookup subnet_map.csv | where subnet LIKE "111.111.111.111%" | table hostname,subnet ... I'd prefer to be able to grab the subnet field from a search like: |inputlookup subnet_map.csv | where host LIKE "my_host%" | table subnet ... and push it into the "where subnet LIKE "subnet" ... so that I grab a list of all hosts in the matching subnet but by using a single hostname.

In essence, what I need to do is take the output of one inputlookup request and pipe it to a second one.

I apologize if I'm wording this poorly.

Thank you.

Tags (1)
0 Karma

pkeller
Contributor

Ultimately was able to get this sorted out by using the following search syntax ...

|inputlookup mylookup.csv | search [|inputlookup mylookup.csv | table hostname,subnet | where hostname like "foobar-host%" | return subnet ]

0 Karma

gkanapathy
Splunk Employee
Splunk Employee
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...