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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...