Splunk Search

How to Modify Multiselect Dropdown Menus for Indexes and Backslashes Using Tokens in Splunk

otto1
Observer

Hello Splunkers, 

I started to use splunk uni forwarder in my job and I am kinda new to systems.


My dashboard working good with standart ALL option in multiselection but when it comes to select multiple indexes from menu I've got a huge problem.

My multiselect search index is:

index="myindex"

sourcetype="pinginfo"

source="C:\\a\\b\\c\\d\\e\\f f\\g\\h\\ı-i-j\\porty*"


|table source
|dedup source

 
but when I pass  this token to reports as:

$multi_token$
| eval ping_error=case(
    like(_raw, "%Request Timeout%"), "Request_Timeout",
    like(_raw, "%Destination Host Unreachable%"), "Destination_Host_Unreachable")
| where isnotnull(ping_error) AND NOT like(_raw, "%x.y.z.net%")
| stats count as total_errors by _time, source
| timechart span=1h sum(total_errors) as total_errors by source

  
it creates a search string with only single backslashes but double back slashes..

source="C:\a\b\c\d\e\f f\e\g\ı-i-j\porty102"
| eval ping_error=case(
    like(_raw, "%Request Timeout%"), "Request_Timeout",
    like(_raw, "%Destination Host Unreachable%"), "Destination_Host_Unreachable")
| where isnotnull(ping_error) AND NOT like(_raw, "%x.y.z.net%")
| stats count as total_errors by _time, source
| timechart span=1h sum(total_errors) as total_errors by source

 

I've tried so many things but couldn't be able to solve it. 

Important Note:

In multiselect dropdown menu  elements are shown with their whole source adrees such as:

C:\a\b\c\d\e\f f\d\e\ı-i-j\porty102

Couldn't be able to show this also.


I can't change anything about splunk universal forwarders settings or the source adress because restrictions are so strict in the company.

Regards

Labels (5)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

This is somewhat confusing.  Do you mean to say that you have a multiselect token that evaluates into the search expression shown in the first code box, or is that one of multiselect values?  If the former, I strongly suggest that you rethink the strategy because a user may well end up composing a token that evaluates into

|table source

index="myindex"

sourcetype="pinginfo"

source="C:\\a\\b\\c\\d\\e\\f f\\g\\h\\ı-i-j\\porty*"

|dedup source

This is probably not what the user wanted.

Regardless, if your really, really want double backslash - I really can't conjure up a good reason for that even in a Microsoft world, you need something like

index="myindex"

sourcetype="pinginfo"

source="C:\\\\a\\\\b\\\\c\\\\d\\\\e\\\\f f\\\\g\\\\h\\\\ı-i-j\\\\porty*"


|table source
|dedup source

 

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...