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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...