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!

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, ...