Dashboards & Visualizations

Newbie: How to create a variable out of multiple fields before passing it to link tag?

jalau9
Explorer

Hi, I'm trying to build HTML links inside a drilldown tag, but that link is quite complex as it uses a few fields in a row. How do I first create the string before putting it into the section? I guess I should use eval but how do I put it into the link tag? This dashboard has multiple tables, but this link only applies to this table.

<row>
<table>
<searchString>index=all | stats count a b c</searchString>
<drilldown target="_blank">
<link field="field1">http:my_url/(complex string)/field1/field2.html</link>
</drilldown>
</table>
</row>

How do I create an eval variable that I pass to link? Sorry if this is so newbie, it's such a simple thing but I don't know how to do it in Splunk.

0 Karma

helenashton
Path Finder

Hi,

You could use an eval to create your link
i.e.

<searchString>index=all | stats count a b c | eval mylink=a+"/"+b+"/"+c+".html"</searchString>

but I think you might run into problems with the slashes getting encoded.

It's just as simple to put your link info in the link tag as it is in the eval.
i.e.

  <drilldown target="_blank">
        <link>http://myurl/$row.a$/$row.b$/$row.c$.html</link>
  </drilldown>

You can also use hidden fields in your URL I believe.
Check the following link for the different options on grabbing clickable values/columns etc.
http://docs.splunk.com/Documentation/Splunk/6.2.1/Viz/Understandbasictableandchartdrilldownactions#D...

Hope this helps.

0 Karma

MuS
SplunkTrust
SplunkTrust

jalau9
Explorer

I don't mean event tokens like click.value, row.. It is a complex string, made up of substr, concatenation and replace functions. Are these functions doable inside the link tag? HTML is not something I've mastered, so please be patient.

0 Karma

helenashton
Path Finder

Ah! I didn't appreciate that from your example. You certainly can.

For a list of the eval functions check out http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/CommonEvalFunctions

My example showed a simple eval, but you can do all sorts.
You mentioned replace...
eval myLink=replace(a,"bob","mary")

You don't need any HTML knowledge here, just explore eval.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...