Dashboards & Visualizations

How to set token in search and use it in a chart title?

seva98
Path Finder

In my dashboard I have two ChartElements (el1 with search1 and el2 with search2).

I need to set token $hierarchy$ in search1 and use it in title of el2.

I was able to use token in the title and set it manually with setToken("hierarchy", "need to have $hiearchy$ here") but I am not sure how to set token inside the search1.

For example, I need functionality similar to this (this example is not working) ... | eval $hierarchy$="new title"which will make title of el2 equal to new title

Btw, I am using dashboard that was converted into HTML.

0 Karma
1 Solution

seva98
Path Finder

Finally found a solution.
HTML part:

<div class="panel-head">
   <h3>$hierarchy$</h3>
</div>

JS part:

// right under var search1 = new PostProcessManager({ ... })

new SearchEventHandler({
            managerid: 'search1',
            event: 'done',
            actions: [
                {
                    'type': 'set',
                    'token': 'hierarchytop',
                    'value': '$result.hierarchy$'
                }
            ]
        }

View solution in original post

0 Karma

seva98
Path Finder

Finally found a solution.
HTML part:

<div class="panel-head">
   <h3>$hierarchy$</h3>
</div>

JS part:

// right under var search1 = new PostProcessManager({ ... })

new SearchEventHandler({
            managerid: 'search1',
            event: 'done',
            actions: [
                {
                    'type': 'set',
                    'token': 'hierarchytop',
                    'value': '$result.hierarchy$'
                }
            ]
        }
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...