Splunk Search

Difference between last(X) and latest(X)

strive
Influencer

Hi,

What is the difference between last(X) and latest(X) functions for stats. I tried both in searches and i get same output. The difference is not quite clear in splunk documentation http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonStatsFunctions

I would like to know the exact difference between these two functions.

Thanks

Strive

Tags (2)
1 Solution

dart
Splunk Employee
Splunk Employee

You see the same output likely because you are looking at results in default time order.

This search (for me, on the tutorial sample data) gives me four different values:

sourcetype="access_combined_wcookie" | sort time_taken | stats first(c_ip) latest(c_ip) last(c_ip) earliest(c_ip) 

first and last are by 'data order', earliest and latest are by 'time order'.

View solution in original post

dart
Splunk Employee
Splunk Employee

You see the same output likely because you are looking at results in default time order.

This search (for me, on the tutorial sample data) gives me four different values:

sourcetype="access_combined_wcookie" | sort time_taken | stats first(c_ip) latest(c_ip) last(c_ip) earliest(c_ip) 

first and last are by 'data order', earliest and latest are by 'time order'.

strive
Influencer

You are right. Thanks a lot.

0 Karma
Get Updates on the Splunk Community!

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

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