Splunk Search

How to write a seach query with 2 searches

TomCollick
Explorer

I need to know how to write a search query with 2 searches where the second search takes the value of the field, IP address, in the first search part to find a hostname that goes with the ip found and displays the ipaddress and hostname results in a table together.

Tags (3)

dwaddle
SplunkTrust
SplunkTrust

You might be more satisfied with a lookup table for ip_address to hostname. This can be done easily with a CSV hosts file, or be tied into DNS lookups automatically. See http://www.splunk.com/base/Documentation/latest/Knowledge/Addfieldsfromexternaldatasources for information on setting either a static or dynamic lookup.

0 Karma

Ant1D
Motivator

Something like this should work:

your_1st_search | join type=left ip_address [search your_2nd_search | fields ip_address hostname]

Get Updates on the Splunk Community!

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...