Getting Data In

How can I grab the latest source from a csv file, ranging from the earliest to anything within 5 minutes of that time?

chadman
Path Finder

I have splunk import a csv file every time it's changed. Splunk imports each line of the csv file as an event. I have tried to do a search by the latest time and that works, but sometimes it takes couple seconds for splunk to import the file and it will have multiple time stamps across all the events for that one import. Any way to grab the latest source from the earliest to anything with 5 min of that time?

0 Karma

somesoni2
Revered Legend

Try like this

index=foo sourcetype=bar source=*yourfile.csv  [| tstats max(_time) as latest WHERE index=foo sourcetype=bar source=*yourfile.csv |eval latest=latest+1 |  eval earliest=relative_time(lateset,"-5m") | table earliest latest ]
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...