Dashboards & Visualizations

How do you change the token value before a search?

damucka
Builder

Hello,

In my dashboard, I am using the custom drilldown where I want to pass a filename to a search. For Windows, it seems I have to replace the single backslash with a double backslash in order for the search to work.

Now, I would like to change the value of my token before search. The original drilldown search with single backslash in the file path was:

    * source="$row.Tracefile$"

I wanted to replace it with something like this:

    * source= search[|eval Tracefile="$row.Tracefile$" | rex mode=sed field=Tracefile "s/(\\\)/\1\1/g"]

But it does not work.

Is there any simple way to replace the \ with \ in the $row.Tracefile$ before using it in the Drilldown search?

Kind Regards,
Kamil

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Have you tried source=$row.Tracefile|s$ to let Splunk escape some values and wrap the result in quotes? Not sure if it handles backslashes, but worth a try.

If that doesn't work you can use <eval token="escaped_tracefile">escape logic here</eval> in your drilldown instead of <set ...>.

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Have you tried source=$row.Tracefile|s$ to let Splunk escape some values and wrap the result in quotes? Not sure if it handles backslashes, but worth a try.

If that doesn't work you can use <eval token="escaped_tracefile">escape logic here</eval> in your drilldown instead of <set ...>.

0 Karma
Get Updates on the Splunk Community!

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...