Splunk Search

Another rex field with backslashes question.

rfiscus
Path Finder

I can test

\\[\w]+\\[\w]+\\(?<File_Path>.+) or simply \\\w+\\\w+\\(?<File_Path>.+)

in Rex101 and it works fine

In Splunk, | rex field=_raw "\[\w]+\[\w]+\(?<File_Path>.+)"

I get Regex: unmatched closing parenthesis.

What would be the proper way to escape the backslashes in Splunk, I have search for examples but with no definitive answers?

Raw data:

Application Information:
Process ID: 3160
Application Name: \device\harddiskvolume4\program files\common files\microsoft shared\clicktorun\officeclicktorun.exe

Network Information:
Direction: Outbound

I just want the output to be:

program files\common files\microsoft shared\clicktorun\officeclicktorun.exe

in this example.

 

Labels (2)
0 Karma
1 Solution

rfiscus
Path Finder

Haha, I tried two and four, apparently didn't try three.  Thanks!

View solution in original post

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @rfiscus,

You should add one more backslash for escape backslash like below;

| rex field=_raw "\\\[\w]+\\\[\w]+\\\(?<File_Path>.+)"

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

rfiscus
Path Finder

Haha, I tried two and four, apparently didn't try three.  Thanks!

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...