Splunk Search

Get the recent event date from a .csv using inputlookup at the same time append a wildcard into the host.

ephraimjoseph
New Member

Currently, this is my SPL query and it just displays different results

this is my hostname_list.csv

host
hostname_a*
hostname_b*
hostname_c*



| inputlookup hostname_list.csv
| fields host
| join type=inner host [search index=unix | stats latest(_time) as latest_time, latest(source) as source, latest(_raw) as event by host | convert ctime(latest_time) as latest_time] | table host, latest_time, source, event

and it displays like this one:

hostlatest_timesourceevent
hostname_a*   
hostname_b*   
hostname_c*   

I assume that the wildcard "*" is acting like a literal string.

I'm expecting results like this.

hostlatest_timesourceevent
hostname_a12testtesttest
hostname_a23testtesttest
hostname_c123testtesttest



please help thanks!

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

index=unix [|inputlookup hostname_list.csv]
| stats latest(_time) as latest_time, latest(source) as source, latest(_raw) as event by host | convert ctime(latest_time) as latest_time | table host, latest_time, source, event
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...