Splunk Enterprise

How to replace backslash by double backslash using eval in search and props.conf

jay
Engager

for example :  C:\user\process  -->  C:\\user\\process

Labels (1)
Tags (1)
1 Solution

manan_amin
Explorer

In Eval, We can use string format function (replace) to replace "\" by two "\\". 

Here, We need to escape "\" two times,

One of the way to replace it,

 

props.conf 

EVAL-new_path = replace(path ,"(\\\\)","\\\\\1")

 

in Search Query:

| eval new_path = replace(path ,"(\\\\)","\\\\\1")

View solution in original post

manan_amin
Explorer

In Eval, We can use string format function (replace) to replace "\" by two "\\". 

Here, We need to escape "\" two times,

One of the way to replace it,

 

props.conf 

EVAL-new_path = replace(path ,"(\\\\)","\\\\\1")

 

in Search Query:

| eval new_path = replace(path ,"(\\\\)","\\\\\1")

Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...