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!

Stay Connected: Your Guide to January Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...

[Puzzles] Solve, Learn, Repeat: Reprocessing XML into Fixed-Length Events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...