Splunk Search

What regex to use to remove \\ form the hostname fields?

SabariRajanT
Path Finder

Hi All,

I have a hostname stating \\sent134

I need to remove this \\ using regex and it should be like this:  sent134

Actual:

\\sent134

Expected should be:

sent134

===

Please provide regex to remove \\ form the hostname fields.

Thanks

Labels (1)
Tags (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

Hi

| makeresults
| eval foo="\\\\sent134"
| fields - _time
```above generates testdata like "\\sent134" ```
| rex mode=sed field=foo "s/\\\//g"

previous should work. If needed add/remove \-characters (as usually 😉

r. Ismo 

View solution in original post

SabariRajanT
Path Finder

Thanks @isoutamo 

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

| makeresults
| eval foo="\\\\sent134"
| fields - _time
```above generates testdata like "\\sent134" ```
| rex mode=sed field=foo "s/\\\//g"

previous should work. If needed add/remove \-characters (as usually 😉

r. Ismo 

Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

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

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...