Dashboards & Visualizations

Create a dashboard button to modify earliest parameter of a search

tgow
Splunk Employee
Splunk Employee

We've got a status panel on a custom dashboard with a single value that displays the count of a field containing an error code. The view is refreshed every minute, so a running total of the error code is displayed. That all works fine. What we would like to do is add a button, like a submit button, that when pressed would modify the earliest parameter of the search to use a current time, essentially resetting the count to zero. source=monitor.txt eventtype=nl_data_error earliest=$st$ | stats count AS errs

Right now my $st$ parameter is hardcoded to a start time, but I'd like some action (like pressing the button) to modify that parameter with a new time.

Is dynamically resetting the earliest value even possible, or is there maybe some other way to reset the count?

Tags (2)
0 Karma

sideview
SplunkTrust
SplunkTrust

If when the page loads, it's acceptable for the initial search to be submitted also with the earliest time set to the current time, then this will work:

* [ | stats count | eval earliest=now() | table earliest ] | stats count AS errs

The subsearch isn't really a search at all, but just a little trick to get an "earliest=1231421" searchterm out to the main search, such that the value will always be set to the current time when the search is dispatched.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...