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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...