Dashboards & Visualizations

How to parse the string while opening

aditsss
Motivator

Hi All,

I have one requirement. 

I have one Dashboard in form of table and have one hyperlink column in it.

My hyperlink column is "url" and its like below:

https://ecp-dev.aexp.com:444//ni/?processGroupId=ef451556-016d-1000-0000-00005025535d&componentIds=f...

The issue here is after 444 there are two // it should be only one.

How can I parse this string. 

Can someone guide me.

Thanks in advance

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try fewer backslashes

| rex field=url mode=sed "s/\\/\\//\\//g s/https:/https:\\//g"

or

| rex field=url mode=sed "s/\/\//\//g s/https:/https:\//g"

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could try converting // to / and then put the double // back in after the https:

| rex field=url mode=sed "s/\\\/\\\//\\\//g s/https:/https:\\\//g"

(Not sure if the number of backslashes is correct) 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Does it matter? Doesn't the browser handle it for you anyway?

0 Karma

aditsss
Motivator

@ITWhisperer 

I am getting the below Error. Can you guide me where I have gone wrong.

Error in 'rex' command: Failed to initialize sed. Invalid option string: /\\//g

Below is the query for the same:

<row>
<panel>
<table>
<search>
<query>index=abc sourcetype=xyz source="/nifi-user.log" $process_tok1$
| rex field=_raw "(?&lt;id&gt;[A_Za-z0-9]{8}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{12})"
| join type=outer id [inputlookup nifi_api_parent_chains_e1.csv]|search $ckey$|search $usr$|eval ClickHere=url| rex field=url mode=sed "s/\\\/\\\//\\\//g s/https:/https:\\\//g"
| table _time _raw host id parent_chain url
</query>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">cell</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
<fields>["_time","_raw","host","id","parent_chain","url"]</fields>
<drilldown>
<condition field="url">
<link target="_blank">$row.url|n$</link>
</condition>
</drilldown>
</table>

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try fewer backslashes

| rex field=url mode=sed "s/\\/\\//\\//g s/https:/https:\\//g"

or

| rex field=url mode=sed "s/\/\//\//g s/https:/https:\//g"
0 Karma

aditsss
Motivator

@ITWhisperer 

 

You are best as always.

0 Karma
Get Updates on the Splunk Community!

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...