Dashboards & Visualizations

Set Token which is not in the result of search

tdoSplunk
Path Finder

Hi,

I want to create a simple list in my dashboard where I can see all assigned Apps(Only with one column, the AppName). The rows are clickable.
That was no problem, but my second requirement is to create a link to a dashboard of the clicked App.

To achieve this goal I created a search

  <query>|rest /servicesNS/-/-/data/ui/views 
|rename eai:appName as AppID, label as DashboardName, title as DashboardID
|search  DashboardID=*overview 
|join AppID [ | rest /services/apps/local |search label="$selectedApp$" |rename title as AppID| table AppID label ] 
|eval selectedApp=AppID, relatedDashboard=DashboardID
|table label</query>
          <finalized>
            <condition match=" $job.resultCount$ >= 1">
              <set token="tokselectedApp">$result.selectedApp$</set>
              <set token="tokrelatedDashboard">$result.relatedDashboard$</set>
            </condition>
          </finalized>
 </query>

The Tokens will be used to create the link

 <drilldown>
          <link target="_blank">../$tokselectedApp$/$tokrelatedDashboard$</link>
 </drilldown>

This Approach does only work when I modify the search to

<query>|rest /servicesNS/-/-/data/ui/views 
 |rename eai:appName as AppID, label as DashboardName, title as DashboardID
 |search  DashboardID=*overview 
 |join AppID [ | rest /services/apps/local |search label="$selectedApp$" |rename title as AppID| table AppID label ] 
 |eval selectedApp=AppID, relatedDashboard=DashboardID
 |table label, selectedApp, relatedDashboard</query>

But I do not want to have the fields selectedApp and relateddashboard in my results view.

Is the Approach completely wrong or how does it work?

Hope you can help me
best regards,
Thomas

Tags (1)
0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@tdoSplunk,

You can use the underscore field name for that (_field)

Try this example where we dont want to see the source value in table but token is set with that and displayed in html panel.

<dashboard>
  <label>Token based Dashboard</label>
  <row>
    <panel>
      <table>
        <search>
          <query>index=_*| stats count by sourcetype,source|rename source as _source</query>
          <earliest>-5m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">cell</option>
        <option name="refresh.display">progressbar</option>
        <drilldown>
          <set token="my_token">$row._source$</set>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <html>
    <h1>Here is the value selected :  $my_token$</h1>
  </html>
  </row>
</dashboard>
Happy Splunking!

View solution in original post

0 Karma

renjith_nair
SplunkTrust
SplunkTrust

@tdoSplunk,

You can use the underscore field name for that (_field)

Try this example where we dont want to see the source value in table but token is set with that and displayed in html panel.

<dashboard>
  <label>Token based Dashboard</label>
  <row>
    <panel>
      <table>
        <search>
          <query>index=_*| stats count by sourcetype,source|rename source as _source</query>
          <earliest>-5m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">cell</option>
        <option name="refresh.display">progressbar</option>
        <drilldown>
          <set token="my_token">$row._source$</set>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <html>
    <h1>Here is the value selected :  $my_token$</h1>
  </html>
  </row>
</dashboard>
Happy Splunking!
0 Karma

tdoSplunk
Path Finder

Thank you very much. Works great for me!

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...