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.
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.
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.
Sure, I'll try this and update you. Thanks.