Dashboards & Visualizations

Splunk table and drill down in Dashboard Studio

SplunkerNoob
Loves-to-Learn Lots

I have a Splunk table that has 3 rows and a count for each row. How do I make each value in table go to a different URL.  This is what I have but every row I click goes to that link. I want each table to go to a different link.

    "type": "splunk.table",
    "dataSources": {
        "primary": "ds_5ds4f5"
    },
    "title": "Device Inventory",
    "eventHandlers": [
        {
            "type": "drilldown.customUrl",
            "options": {
                "url": "https://device.com",
                "newTab": true
            }
        }
    ],
Labels (1)
0 Karma

SplunkerNoob
Loves-to-Learn Lots

I think it is working but unfortunately I get:

The URL you clicked cannot open as it is invalid and might contain malicious code. Change the URL to a relative or absolute URL, such as /app/search/datasets or https://www.splunk.com.

0 Karma

KendallW
Contributor

Hi @SplunkerNoob 

Assuming these are external URLs (not other dashboards/searches within Splunk), you can add the trusted domains to the drilldownUrlWhitelist setting in the web.conf file. 


@SplunkerNoob wrote:

I think it is working but unfortunately I get:

The URL you clicked cannot open as it is invalid and might contain malicious code. Change the URL to a relative or absolute URL, such as /app/search/datasets or https://www.splunk.com.


0 Karma

KendallW
Contributor

Hi @SplunkerNoob, first create a field in your search which contains the URLs, e.g. 

...
| eval target_url=case(
    device_type=="type1", "https://device1.com",
    device_type=="type2", "https://device2.com",
    device_type=="type3", "https://device3.com",
    1=1, "https://default.com"
)

 

Then in your dashboard:

<drilldown>
    <link target="_blank">{{row.target_url}}</link>
</drilldown>
0 Karma

KendallW
Contributor

Or with JSON:

{
    "type": "splunk.table",
    "dataSources": {
        "primary": "ds_5ds4f5"
    },
    "title": "Device Inventory",
    "eventHandlers": [
        {
            "type": "drilldown.customUrl",
            "options": {
                "url": "{{row.target_url}}",
                "newTab": true
            }
        }
    ]
}
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!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...