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 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...