Hi community,
I am trying to create a drilldown for a table using a cell value that contains a URL (or part of it).
These are the problems I'm facing:
1) Splunk converts the '/' in the cell value to '%2F'.
2) Cell becomes unclickable when cell value (containing part of URL) starts with '/'.
To explain the problems, here is a table with different use cases that you can also copy and play with:
<table>
<search>
<query>index=_internal | head 1
| eval can_click = "dev.splunk.com"
| eval cannot_click = "dev.splunk.com/view/webframework-codeexamples/SP-CAAAEVU"
| eval can_click_but_forward_slashes_replaced = "view/webframework-codeexamples/SP-CAAAEVU"
| table can_click, cannot_click, can_click_but_forward_slashes_replaced, with_cdata__cannot_click, with_cdata__can_click_but_forward_slashes_replaced
</query>
</search>
<drilldown target="_blank">
<condition field="can_click">
<link>http://$row.can_click$</link>
</condition>
<condition field="cannot_click">
<link>http://$row.cannot_click$</link>
</condition>
<condition field="can_click_but_forward_slashes_replaced">
<link>http://dev.splunk.com/$row.can_click_but_forward_slashes_replaced$</link>
</condition>
<condition field="with_cdata__cannot_click">
<link><![CDATA[http://$row.cannot_click$]]></link>
</condition>
<condition field="with_cdata__can_click_but_forward_slashes_replaced">
<link><![CDATA[http://dev.splunk.com/$row.can_click_but_forward_slashes_replaced$]]></link>
</condition>
</drilldown>
</table>
My question: How can make a drilldown use a cell value containing a URL (or even just part of it)?
You have to enable no character escaping using n$ in all your tokens having URL escape characters. Following should work.
<drilldown>
<condition field="can_click">
<link>http://$row.can_click$</link>
</condition>
<condition field="cannot_click">
<link>http://$row.cannot_click|n$</link>
</condition>
<condition field="can_click_but_forward_slashes_replaced">
<link>http://dev.splunk.com/$row.can_click_but_forward_slashes_replaced|n$</link>
</condition>
<condition field="with_cdata__cannot_click">
<link><![CDATA[http://$row.cannot_click|n$]]></link>
</condition>
<condition field="with_cdata__can_click_but_forward_slashes_replaced">
<link><![CDATA[http://dev.splunk.com/$row.can_click_but_forward_slashes_replaced|n$]]></link>
</condition>
</drilldown>
Refer to the documentation for details: http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens