Dashboards & Visualizations

How can I show customized hyperlink text on a dashboard instead of showing the full URL?

Explorer

I have a field that stores a dynamic URL. It is always unique. I am clicking that link and it takes me to a report in a different platform. How can I show customized hyperlink text on the dashboard instead of showing the full link/URL?

Example: "Report Link" instead of https://etc...

I don't think I can use eval because the field is dynamic.

SplunkTrust
SplunkTrust

Are you trying to do this in Table or Chart visualization? I am hoping this is for Table since you want to Show Report Link.

You can use <fields> Simple XML Configuration reference and show only the required fields. You Dynamic URL Field will be hidden and still available as token for drilldown.

Following is a sample code since you have not provided field names for your dashboard:

Step 1: Add a dummy "Report Link" field to your search. Pipe the following:

| eval reportLink="Report Link"

Step 2: Edit the Simple XML for table and after </search> introduce <fields>, to add the fields you need including the dummy link field reportLink

<fields>your_field_1, your_field_2, your_field_3, reportLink</fields>

Step 3: Code drilldown for table to allow click only if reportLink field value is clicked(optional). Code link to launch the URL based on your_URL_Field. PS: Based on the URL partial, internal to Splunk, external, you might need to adjust the code for link (however, since you just want to hide the URL, I expect you already have this in place.

<drilldown>
          <condition field="reportLink">
            <link>$row.your_URL_Field$</link>
          </condition>
<drilldown>

Refer to Splunk Documentation for details on the following:
fields Attribute: https://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#Attributes_8
Link : http://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#link

Also check out Table Elements With Hidden Fields Example and DrillDown Elements section in the Splunk 6.x Dashboard Examples App for examples.

PS: Something similar can be done for Charts as well, but the steps are a bit different.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

Communicator

This answer solved the problem for me. I was generating the whole URL, so I had to change the link statement like so:

 <link>$row.your_URL_Field|n$</link>

Thanks for the comprehensive answer!

0 Karma

Esteemed Legend

You use fieldformat like this:

... | fieldformat YourLinkFieldNameHere = "Report Link"
0 Karma

Explorer

Thanks for the prompt response. That broke the URL. I just want to display a different string on the dashboard but leave the URL value in the token. Did I say that right?

0 Karma

Esteemed Legend

It does not break the URL; it just looks like it does. Trust me and TRY IT. It does exactly what you are desiring to do.

0 Karma

Communicator

Found this answer because I am trying to solve the same problem as OP. Also found that the | fieldformat code breaks the link to the external search.

Here is the XML code we are using to make the link clickable, could that be the problem?

        <drilldown target="blank">
          <condition field="HyperLink">
            <link>$click.value2|n$</link>
          </condition>
        </drilldown>

Edit to add:

  • We are dynamically creating the url
  • The url is one field in a table
0 Karma