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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...