Splunk Search

Earliest and Latest as Variables in Search

tristanmatthews
Path Finder

I'm running a scheduled search that uses the script command to call a python script, which generates a file. I'd really like to name the file something useful like:

output_[earliest]_to_[latest].dat

where [earliest] and [latest] are the bounds of the search window.

I'm currently just grabbing the first and last result times and using those, but that has two problems.

First they aren't the bounds of the search so you loose the information about there being no results between their time and the search window. Second even though my script is set to be non-streaming it seems to run multiple times with partial results while before it finishes so I get multiple files (which I would rather just overwrite as I go).

Thanks

Tags (2)
0 Karma
1 Solution
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...