Splunk Search

How to update a search after setting token value?

chaninphx
Path Finder

Hi, I'm very new to Splunk. I'm trying to implement a reset button that will update the token value text_name to have an empty string value. However the startSearch function will just run the previous search from before without the updated token value. Is there a way to work around this?

$("#reset_button").click(function(){
            var tokens = mvc.Components.get("default");
            //console.log(tokens.get("text_name"));
            var searchObj2 = mvc.Components.getInstance("search2");
            tokens.set("text_name", "");
            searchObj2.startSearch();
        });
0 Karma
1 Solution

rjthibod
Champion

You probably need to use the "submitted" token model instead of "default".

var tokens = mvc.Components.get('submitted');

View solution in original post

0 Karma

rjthibod
Champion

You probably need to use the "submitted" token model instead of "default".

var tokens = mvc.Components.get('submitted');

0 Karma

chaninphx
Path Finder

Awesome! Thank you!

0 Karma
Get Updates on the Splunk Community!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...