Dashboards & Visualizations

How come my dashboard eval token is not working correctly?

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

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

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

SplunkTrust
SplunkTrust

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

0 Karma

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