Splunk Search

Show last update from indexed csv file

jugarugabi
Path Finder

Hi, 

I have a csv file that is updated by a script once a minute. 
The output is similar to: 

time,queuename,vpn,last-message-id-spooled,max-message-size-exceeded,total-messages-spooled,num-messages-spooled,current-spool-usage-in-mb,bind-count,recordsinperiod,eol
2021-05-20_10-20,q.static.prp.solacequeue, test_uat_de, 117446717393, 0, 40340019 , 0, 0, 25 ,0,eol
2021-05-20_10-20,q.static.prp.solacequeue-number2, test_uat_de, 117493, 0, 4039 , 0, 0, 25 ,0,eol
2021-05-20_10-19,q.static.prp.solacequeue, test_uat_de, 0, 0, 0 , 0, 0, 0 ,0,eol
2021-05-20_10-19,q.static.prp.solacequeue-number2, test_uat_de, 0, 0, 0 , 0, 0, 0 ,0,eol

Now, I want to create a search query that will show only the last update in the csv file and show me the result like this: 

q.static.prp.solacequeue, test_uat_de, 117446717393, 0, 40340019 , 0, 0, 25 ,0,eol
q.static.prp.solacequeue-number2, test_uat_de, 117493, 0, 4039 , 0, 0, 25 ,0,eol

Tried using the search below, but the output still shows everything that happened during the day, instead those only 2 lines. 

index=* sourcetype=queues 
| stats latest(time) by time queuename last_message_id_spooled current_spool_usage_in_mb bind_count recordsinperiod

  What am I missing?

Thanks,
Gabriel

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Will this work for you?

index=* sourcetype=queues 
| stats latest(*) as * by queuename

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Will this work for you?

index=* sourcetype=queues 
| stats latest(*) as * by queuename
0 Karma

jugarugabi
Path Finder

Thanks - that simple...

One more question: the line with the header is added as well to the results.
How can I remove that particular line and provide me only the information without the header that can be found in the csv file?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

if you are using inputlookup to read the csv file you can use the start=1 argument. If you already have ingested it into an index, you could use | where time!="time"

0 Karma

jugarugabi
Path Finder

Yup, that did the trick. 

Thanks mate!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...