Splunk Search

Querying when the last time, an event was seen from various hosts in the system

msg4sunil
Path Finder

How to know the last event's time from each of the hosts in the system?.  The output can be of the below format?

host1|datetime

host2|datetime

 

thank you

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Since host is an indexed field you can use

| tstats latest_time by host where index=XXX
0 Karma

msg4sunil
Path Finder

@PickleRick , sorry, I am a normal user and have access to only specific index. Running the above command is failing.

Error in 'tstats' command: Invalid argument: 'index=indexname

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Try without the whole where condition.

0 Karma

msg4sunil
Path Finder

see the below error

Error in 'TsidxStats': A field for an aggregate function is missing or invalid. Aggregate functions require fields with valid values to complete their arguments.
 
0 Karma

PickleRick
SplunkTrust
SplunkTrust

I rarely do the earliest/latest and so on 🙂

Probably max(_time) or latest(_time) will be what you need (they are not the same thing though!). As an excercise, think about the difference between max(_time) and latest(_time) 😉

0 Karma
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

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 ...