Splunk Search

List events from latest log indexed?

bfinney
Engager

I'm looking for help creating a search that returns all events from the last log indexed.
This is what i've tried but it doesnt return the events just the source.

| get all sources from metadata | sort all sources desending by time and only return the last one | join the main index on the source columns

| metadata type=sources | sort 1 recentTime desc
| fields source
| join source [search index=main | fields source]

0 Karma

jonuwz
Influencer

So close ...

* [ | metadata type=sources | sort 1 recentTime desc | fields source ]

The subsearch in the [ .. ] expands to ( source=your_latest_source )

So the main search is

* ( source=your_latest_search )

jonuwz
Influencer

Good to know. For the record, you dont have to send extra rep, accepting the answer is the normal way to do that. Cheers

0 Karma

bfinney
Engager

That fixed it. Thanks!

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