Splunk Search

How do I return the time of the first event from a specific host in the main index?

MikeyG
Explorer

Need to determine the date and time of when a specific host first logged to Splunk ...

Tags (1)
0 Karma
1 Solution

ziegfried
Influencer

If you're looking for the date/time of the event (ie. what the value Splunk has extracted from the Event), use this search:

single host:

| metadata type=hosts index=main | search host=<YOUR HOST> | convert ctime(firstTime) | table host firstTime

all hosts:

| metadata type=hosts index=main | convert ctime(firstTime) | table host firstTime

If you're looking for when the first event has been indexed use this search: (Select All time in the time range picker - may take a while)

single host:

index=main host=<YOUR HOST> | stats min(_indextime) as mintime by host | convert ctime(mintime) | table host mintime

all hosts:

index=main | stats min(_indextime) as mintime by host | convert ctime(mintime) | table host mintime

View solution in original post

MikeyG
Explorer

That time/date would be outside the data that's currently in the main index ...

0 Karma

ziegfried
Influencer

If you're looking for the date/time of the event (ie. what the value Splunk has extracted from the Event), use this search:

single host:

| metadata type=hosts index=main | search host=<YOUR HOST> | convert ctime(firstTime) | table host firstTime

all hosts:

| metadata type=hosts index=main | convert ctime(firstTime) | table host firstTime

If you're looking for when the first event has been indexed use this search: (Select All time in the time range picker - may take a while)

single host:

index=main host=<YOUR HOST> | stats min(_indextime) as mintime by host | convert ctime(mintime) | table host mintime

all hosts:

index=main | stats min(_indextime) as mintime by host | convert ctime(mintime) | table host mintime
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...