Splunk Enterprise Security

How can you list all indexes and the time of their first indexed event?

endos
New Member

How can you list all indexes and the time of their first indexed event? metadata seems to only show you the hosts, sources or sourcetypes. I can list all indexes with | eventcount summarize=false index=* | dedup index | fields index . Also tried something like this but with no success:

| eventcount summarize=false index=* index=_* | dedup index | fields index 
| map maxsearches=100 search="|metadata type=sourcetypes index=\"$index$\" | eval index=\"$index$\" | stats min(firstTime) as firstTime by sourcetype
| convert ctime(firstTime) "
| fields index sourcetype firstTime

Any ideas?

0 Karma

gjanders
SplunkTrust
SplunkTrust

If you want to know the first time per index and per sourcetype then tstats is a valid solution:

| tstats earliest(_time) AS _time where index=* OR index=_* by index, sourcetype

However going forward you might want to use something like:
Meta Woot! (I believe this records the first seen times as well as the most recently seen once it is scheduled to run)

Or perhaps these apps might have similar info:
Broken Hosts
TrackMe

0 Karma

kimberlytrayson
Path Finder

It's still going to take a while (I assume you're only doing this once) but can use tstats:

| tstats earliest(_time) as firstTime by index
| convert ctime(firstTime)
0 Karma

TISKAR
Builder

Hello,

Can you try this:

index=_*
| stats earliest(_time) as earliest_index by index
| eval earliest_index=strftime(earliest_index,"%Y-%m-%d %H:%M:%S")

🙂

0 Karma

endos
New Member

Thanks for the answer! 🙂
Yeah this would work fine but we have too much data so the search would take too long. Hence the reason why I tried to solve it with |metadata

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...