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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...