Splunk Search

How to run two different searches in a dashboard based on the selected time range?

Kukkadapu
Path Finder

Hi, How do I run two different searches in a dashboard based on the time picker selected?

If the time selected is
Today or last 24 hours - Run Query 1 to display the result in the single panel
Not Today OR last 24 hours - Run Query 2
Other (Last two days, etc) - Run Query 3

Can we run different searches based on the time picker selected?

Thanks.

0 Karma
1 Solution

arkadyz1
Builder

This is just an idea so far: try to add <condition> and <eval> children under <change> child of the <input type="time"...> tag. Analyze the values and set or unset the tokens according to your needs. Then create a few panels at most one of which will be visible using depends= and rejects= attributes in those panels' tags.

You'll have to read "Dashboards and Visualizations" manual to do everything right. Unfortunately, the documentation does not include ready examples of such complex behavior, but that's the beauty of Splunk development.

Another, a somewhat different idea, is to add id= attribute to your time input and create a JavaScript which will find the time picker by that id and hook a handler to the .change event. In that handler, you can set and unset some tokens to achieve the same result (your panels should still have depends= and rejects= attributes for this to work), but you'll have a much better control of the algorithm.

View solution in original post

0 Karma

arkadyz1
Builder

This is just an idea so far: try to add <condition> and <eval> children under <change> child of the <input type="time"...> tag. Analyze the values and set or unset the tokens according to your needs. Then create a few panels at most one of which will be visible using depends= and rejects= attributes in those panels' tags.

You'll have to read "Dashboards and Visualizations" manual to do everything right. Unfortunately, the documentation does not include ready examples of such complex behavior, but that's the beauty of Splunk development.

Another, a somewhat different idea, is to add id= attribute to your time input and create a JavaScript which will find the time picker by that id and hook a handler to the .change event. In that handler, you can set and unset some tokens to achieve the same result (your panels should still have depends= and rejects= attributes for this to work), but you'll have a much better control of the algorithm.

0 Karma

Kukkadapu
Path Finder

Sure, I'll try this and update you. Thanks.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...