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

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...