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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...