Splunk Search

SPL to return list of field values for a particular time

jabezds
Path Finder

Hi All,

I need a spl which will return the list of filenames that came for the latest time .

| eval latest_time = max(strftime(_time,"%Y-%m-%d")) | stats count by latest_time,filename

But im not able to achieve that through the above spl.

eg

Latest_time             filename

2020-07-28             filename1.txt

                                      filename2.txt

                                      filename3.txt

                                      filename4.txt

0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

From your description it looks like you want a list of filenames that were on the most recent day for where there are files, so 

| bin _time span=1d
| stats values(filename) as filename by _time
| tail 1

If you want individual rows for each filename, then just add

| mvexpand filename

at the end 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

From your description it looks like you want a list of filenames that were on the most recent day for where there are files, so 

| bin _time span=1d
| stats values(filename) as filename by _time
| tail 1

If you want individual rows for each filename, then just add

| mvexpand filename

at the end 

Get Updates on the Splunk Community!

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...