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!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...