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
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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...