Splunk Search

How to make the URL hyperlink which is in the fields value of the table (Dashboard Studio - JSON format)

SureshkumarD
Explorer

Hi Team,

I have generated dynamic URLs using the lookup and add it in the field value of the table. Now I need to make those dynamic URLs as a hyperlink so that we don't want to manually copy and paste the URL in the browser every time. 

SureshkumarD_0-1716401067750.png

I modified the source code as below, but it is working. Please assist on this. Thank you.

"visualizations": {
        "viz_abc123": {
            "type""splunk.table",
            "options": {
                "count"5000,
                "dataOverlayMode""none",
                "drilldown": {
                    "condition": {
                        "field""URL",
                        "link""$row.URL|n$"
                    }
                },
                "backgroundColor""#FAF9F6",
                "tableFormat": {
                    "rowBackgroundColors""> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByBackgroundColor)",
                    "headerBackgroundColor""> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)",
                    "rowColors""> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)",
                    "headerColor""> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)"
                },
                "showInternalFields"false,
                "columnFormat": {
                    "Duration(Secs)": {
                        "data""> table | seriesByName(\"Duration(Secs)\") | formatByType(Duration_Secs_ColumnFormatEditorConfig)",
                        "rowColors""> table | seriesByName(\"Duration(Secs)\") | rangeValue(Duration_Secs_RowColorsEditorConfig)"
                    },
                    "Duration(Mins)": {
                        "data""> table | seriesByName(\"Duration(Mins)\") | formatByType(Duration_Mins_ColumnFormatEditorConfig)",
                        "rowColors""> table | seriesByName(\"Duration(Mins)\") | rangeValue(Duration_Mins_RowColorsEditorConfig)"
                    }
                }
            },
0 Karma

danspav
SplunkTrust
SplunkTrust

Hi @SureshkumarD,

To get the drilldown working from a field in a table you can use the drilldown options:

"eventHandlers": [
   {
      "type": "drilldown.customUrl",
       "options": {
          "url": "$row.URL.value|n$",
          "newTab": true
      }
   }
]

 

You can set that up in the UI with the following:

danspav_0-1716530100503.png

 

0 Karma

SureshkumarD
Explorer

Hi @danspav ,

I replied on Friday that the hyperlink is not working by providing the source code and screenshots. Could you please look into it and assist? Thank you.

0 Karma

SureshkumarD
Explorer

Hi @danspav ,

I added the event handlers and updated $row.URL.value$ in the link to custom url as per your ask, but still the url is not reflecting as hyperlink. Here is the source code and I shared the screenshot of the table below. Thank you.

 

 "visualizations": {
        "viz_qFxEKJ3l": {
            "type""splunk.table",
            "options": {
                "count"5000,
                "dataOverlayMode""none",
                "drilldown""none",
                "backgroundColor""#FAF9F6",
                "tableFormat": {
                    "rowBackgroundColors""> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByBackgroundColor)",
                    "headerBackgroundColor""> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)",
                    "rowColors""> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)",
                    "headerColor""> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)"
                },
                "eventHandlers": [
                    {
                        "type""drilldown.customUrl",
                        "options": {
                            "url""$row.URL.value|n$",
                            "newTab"true
                        }
                    }
                ],
 
 
SureshkumarD_0-1716580237979.png

 

SureshkumarD_1-1716580666781.png

 

0 Karma

danspav
SplunkTrust
SplunkTrust

Hi @SureshkumarD,

I tried out your code - the rows aren't showing up as links because of the table formatting / row color setting.

Remove this line from your code:

    "rowColors": "> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)",

 

That is causing the "link" effect on the clickable rows to disappear.

Here's the full viz code:

"visualizations": {
        "viz_qFxEKJ3l": {
            "type": "splunk.table",
            "options": {
                "count": 5000,
                "dataOverlayMode": "none",
                "drilldown": "none",
                "backgroundColor": "#FAF9F6",
                "tableFormat": {
                    "rowBackgroundColors": "> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByBackgroundColor)",
                    "headerBackgroundColor": "> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)",
                    "headerColor": "> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)"
                },
                "eventHandlers": [
                    {
                        "type": "drilldown.customUrl",
                        "options": {
                            "url": "$row.URL.value|n$",
                            "newTab": true
                        }
                    }
                ],

 Give that a go on your dashboard.

0 Karma

SureshkumarD
Explorer

Hi @danspav ,

Thank you for your response. I made the changes and when I clicked on the hyperlink, it is not redirecting to the correct dynamically generated external URL 'https://abc12345.apps.dynatrace.com/ui/apps/dynatrace.classic.distributed.traces/ui/services/SERVICE...'. Here are the screenshots and code below. Please assist on this.

SureshkumarD_0-1717173033019.png

 

SureshkumarD_1-1717175440878.png

 

"visualizations": {
        "viz_aBCd123": {
            "type""splunk.table",
            "options": {
                "count"5000,
                "dataOverlayMode""none",
                "drilldown""none",
                "backgroundColor""#FAF9F6",
                "tableFormat": {
                    "rowBackgroundColors""> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByBackgroundColor)",
                    "headerBackgroundColor""> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)",
                    "headerColor""> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)"
                },
                "eventHandlers": [
                    {
                        "type""drilldown.customUrl",
                        "options": {
                            "url""$row.URL.value|n$",
                            "newTab"true
                        }
                    }
                ],
0 Karma
Get Updates on the Splunk Community!

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...