Splunk Search

Macro for Backslash Substitution


I have a macro that adds a backslash to an existing backslash:


args = arg
definition = replace("$arg$", "(\\\\)", "\\\\\\\\")
iseval = 1


 This works:


index=perfmon counter=`backslash(\processor)`


 This fails when the arg has spaces:


index=perfmon counter=`backslash("\processor time")`


The expanded search string:


(counter=\\processor index=perfmon time)


How do I get:

index=perfmon counter="\\processor time"

Oh please show me my stupidity as I have been banging my head on the desk for hours... 

Labels (1)
0 Karma
.conf21 Now Fully Virtual!
Register for FREE Today!

We've made .conf21 totally virtual and totally FREE! Our completely online experience will run from 10/19 through 10/20 with some additional events, too!