Splunk Dev

how to remove this annoying character?

giovere
Path Finder

In my log file there at the end of a file there is substitution character \x1A, here is the file with that character. I've tried following:

props.conf
SEDCMD-stripsub = s/\\x1A//g
SEDCMD-stripnull = s/\\x00//g

For null characters \x00 it works perfectly fine, but not the substitution character. Any suggestions how to get rid of it?

Tags (1)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

You shouldn't be escaping the \. If you want to remove a character with hex code x1a, you should use s/\x1a//g. When you see \x1A in the actual raw event, that's simply because Splunk substituted the non-printable character with a printable character sequence. I have no idea why the second one worked, unless your raw data contains the printable string rather than the null character itself.

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

You shouldn't be escaping the \. If you want to remove a character with hex code x1a, you should use s/\x1a//g. When you see \x1A in the actual raw event, that's simply because Splunk substituted the non-printable character with a printable character sequence. I have no idea why the second one worked, unless your raw data contains the printable string rather than the null character itself.

giovere
Path Finder

Feel stupid 🙂 thanks it works

0 Karma

Ayn
Legend

I'm confused - just to clarify, does the second SEDCMD (stripnull) work but the first one doesn't?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

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