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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...