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

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!

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...

Unlock Instant Security Insights from Amazon S3 with Splunk Cloud — Try Federated ...

Availability: Must be on Splunk Cloud Platform version 10.1.2507.x to view the free trial banner. If you are ...