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!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...