Other Usage

Overriding a time range in the saved search

osh55
Engager

For simplicity assume I have the following saved as a report (testReport):

index=testindex host=testhost earliest=-90m latest=now

I need to create 2 bar graphs in the same chart comparing two dates.  For starters I need to be able to run the above with a time I specify overrriding the time range above.

| savedsearch "testReport" earliest="12/08/2024:00:00:00" latest="12/08/2024:23:59:00"

I have seen a few similar question here but I don't think it has  a working solution. 

 

 

Tags (2)
0 Karma

osh55
Engager

I have saved the report using no time range. The report works getting results for  the last 60 minutes as expected.

My issue is when I query the testReport  I want to query with different earliest and latest times, so I can have two time ranges in the same chart.

Something like:

| savedsearch "testReport" earliest="12/08/2024:00:00:00" latest="12/08/2024:23:59:00" | table id, response_time| eval lineSource = "first_day"
| append
[| savedsearch "testReport" earliest="12/09/2024:00:00:00" latest="12/09/2024:23:59:00" | table id, response_time| eval lineSource = "second_day"]

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The savedsearch command has a method for passing variables to the search.  That should make it possible to pass different values for earliest and latest.  See the Search Reference manual for details.

---
If this reply helps you, Karma would be appreciated.
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Per the Search Reference Manual,

  • If you specify All Time in the time range picker, the savedsearch command uses the time range that was saved with the saved search.
  • If you specify any other time in the time range picker, the time range that you specify overrides the time range that was saved with the saved search.
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...