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!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...