Splunk Search

Pull back metadata against 2 fields in a lookup

jacqu3sy
Path Finder

Hi,

I have a lookup file containing hostnames and IP addresses, either of which can be logged in splunk against the 'host' field.

I need to pull back the last time the device logged to Splunk using either of these fields as the 'host'. Currently the following works but only if the hostname of the devices is logging to splunk, if it's logging to splunk using the IP address as the host, this returns a null value. I need the "Latest Time" regardless of how the device is logging. Any help appreciated!!

Query:
| inputlookup devices_test.csv | join type=left [metadata type=hosts]
| eval "Latest Time"=strftime(lastTime,"%d/%m/%Y %H:%M:%S")
| eval "First Time"=strftime(firstTime,"%d/%m/%Y %H:%M:%S")
| fields host, "Latest Time", "First Time"

Lookup:
host,ipaddress
fw1,10.10.10.2
fw2,10.10.10.3

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...