Splunk Search

Why is a token not substituted after a drilldown and search from dashboard1 to dashboard2 with my current Simple XML?

pramaswamy
Path Finder

I have a Splunk application with two Dashboards. Dashboard1 ( D1 ) is a higher level dashboard that reports overall utilization metrics per server across all data centers. Dashboard2 ( D2 ) provides detailed system metrics (code/thread), per server.

I have a timechart visualization using Simple XML in D1 that shows the health of all servers over time. When I click on a server In D1, in the timechart, I need to redirect to D2, by passing some URL parameters so that the dashboards load pre-populated.

To obtain one of the URL parameter values for D2, I need to execute a lookup search by passing the "clicked server" value. The result of the lookup search should be passed.

In order to accomplish this, I have created a hidden panel with depends on the "clicked server" token. The hidden panel executes the search/lookup. Within the "done" tags, I redirect to the D2. The title of the panel contains the search result token, populates the right expected lookup result value. However, the token is not substituted, when the actual redirection happens to D2.

D1 Timechart - for setting "clicked server" token

 <chart>
     .......
      <drilldown>
        <set token="clicked_server">$click.name2$</set>
      </drilldown>
 </chart>

Lookup search code - with hidden panel

<panel depends=" $clicked_server$">
    <input type="dropdown" token="lookup_metric" searchWhenChanged="true" depends="clicked_server">
      <label>Metric  Lookup - Server - $clicked_server$ $lookup_metric$</label>
      <search>
        <query>index=app_index server="$clicked_server$"| head 1 | lookup lookup_tab_name server_name as server OUTPUT Metric as lookup_metric | stats count by lookup_metric</query>
              <done>
                    <link>
                               <![CDATA[Dashboard2?form.metric=$lookup_metric$]]>
                    </link>
              </done>
        </search>
              <selectFirstChoice>true</selectFirstChoice>
              <fieldForLabel>lookup_metric</fieldForLabel>
              <fieldForValue>lookup_metric</fieldForValue>
     </input>
</panel>

What am I missing or doing wrong? Any input or help is greatly appreciated.

0 Karma
1 Solution

sundareshr
Legend

Not sure why, but token does not work when you use selectFirstChoice. Try this instead

        <done>
          <condition match="'job.resultCount' == 1">
            <![CDATA[Dashboard2?form.metric=$result.lookup_metric$]]>
          </condition>
        </done>

View solution in original post

sundareshr
Legend

Not sure why, but token does not work when you use selectFirstChoice. Try this instead

        <done>
          <condition match="'job.resultCount' == 1">
            <![CDATA[Dashboard2?form.metric=$result.lookup_metric$]]>
          </condition>
        </done>

pramaswamy
Path Finder

@sundareshr , you are amazing. That fixed it and works like charm. Thank you very much.

It will be great, if this gap is addressed by the product team.

0 Karma

sundareshr
Legend

Have to set the field for label and value?

      <fieldForLabel>lookup_metric</fieldForLabel>
     <fieldForValue>lookup_metric</fieldForValue>
0 Karma

pramaswamy
Path Finder

@sundareshr , Thanks for pointing it out. I did have that in my code, but forgot to include it in the code in this post. I have updated to include what I have. Any other thoughts?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...