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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

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 ...