Dashboards & Visualizations

How come my dashboard eval token is not working correctly?

jpalmiero
New Member

I have two “parallel” multivalue fields. One has friendly names and the other has the actual URL. In the example below, given the friendly name (cnn), it finds the corresponding URL:

| makeresults 
| fields - _time 
| eval friendly_names="google,facebook,cnn", urls="http://google.com,http://facebook.com,http://cnn.com" 
| makemv friendly_names delim="," 
| makemv urls delim="," 
| eval url=mvindex(urls, mvfind(friendly_names,"cnn")) 
| table url

This works exactly as I expect it to. When I try to use it in a dashboard event handler, it doesn’t work.

Anyone have any thoughts on what I might be doing wrong or an alternative way to do this? My desire is to generate some custom ugly URLs behind the scenes, but to present the user with friendly names on the dashboard.

<dashboard>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults 
| fields - _time 
| eval friendly_names="google,facebook,cnn", urls="http://google.com,http://facebook.com,http://cnn.com" 
| makemv friendly_names delim="," 
| makemv urls delim="," 
| table friendly_names</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">50</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
        <drilldown>
          **<condition field="friendly_names">
            <eval token="url">mvindex(urls,mvfind(friendly_names,"$click.value2$"))</eval>
            <link target="_blank">
                <![CDATA[$url|n$]]>
            </link>
          </condition>**
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>
0 Karma
1 Solution

vnravikumar
Champion

Hi @jpalmiero

Try this and let me know

<dashboard>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults 
| fields - _time 
| eval friendly_names="google,facebook,cnn", urls="http://google.com,http://facebook.com,http://cnn.com" 
| makemv friendly_names delim="," 
| makemv urls delim="," 
| eval temp=mvzip(friendly_names, urls) 
| mvexpand temp 
| makemv temp delim="," 
| eval friendly_names=mvindex(temp, 0) 
| eval urls=mvindex(temp, 1) 
| table friendly_names,urls</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">50</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
        <fields>["friendly_names"]</fields>
        <drilldown>
          <eval token="url">replace($row.urls$, "http://", ""</eval>
          <link target="_blank">
            <![CDATA[ http://$url$ ]]>
          </link>
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>

View solution in original post

0 Karma

vnravikumar
Champion

Hi @jpalmiero

Try this and let me know

<dashboard>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults 
| fields - _time 
| eval friendly_names="google,facebook,cnn", urls="http://google.com,http://facebook.com,http://cnn.com" 
| makemv friendly_names delim="," 
| makemv urls delim="," 
| eval temp=mvzip(friendly_names, urls) 
| mvexpand temp 
| makemv temp delim="," 
| eval friendly_names=mvindex(temp, 0) 
| eval urls=mvindex(temp, 1) 
| table friendly_names,urls</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">50</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
        <fields>["friendly_names"]</fields>
        <drilldown>
          <eval token="url">replace($row.urls$, "http://", ""</eval>
          <link target="_blank">
            <![CDATA[ http://$url$ ]]>
          </link>
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>
0 Karma

lakshman239
Influencer

Have you looked at using the custom urls in a lookup and tie that to actual url? [ so basically 3 columns - friendly_url, actual_url, status] and tie them up when user select friendly names?

0 Karma

jpalmiero
New Member

sorry, not exactly following you. the examples above are for demonstration purposes only. in the real example, i will have a dynamic list of host names in the multi value field and then when they click on it i want to take the into one of our host health dashboards. the URLs for the host health dashboards are messy so I want to hid them in another multi value field.

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 ...