Splunk Search

Unable to anonymize / mask data using regex

zerolife
Explorer

I'm trying to mask the IP address from the below sample syslog per the following guide but it's just not working. Is my regex expression wrong? I'm no regex guru so I'm generating the regex expression from online tools.
http://docs.splunk.com/Documentation/Splunk/6.0.2/Data/Anonymizedatausingconfigurationfiles

Sample Log:
Apr 11 10:47:30 192.168.1.1 stingray_xml_slave: ....

pref.conf:

[syslog]
TRANSFORMS-anonymize = testing

transforms.conf:

[testing]
REGEX = \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
FORMAT = $1#####$2
DEST_KEY = _raw

I also tried the following Regex expresion generated by txt2re.com with no luck either:

((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(?![\\d])
Tags (1)
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try this.

props.conf

[syslog]
SEDCMD-ipaddress = s/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/xxxxx/g

no transforms.conf entries.

View solution in original post

zerolife
Explorer

I was an idiot, had mistyped props -> pref. thanks somesoni2 and Ayn for your help

Ayn
Legend

Any particular reason why you're using TRANSFORMS for this and not SEDCMD?

Also I'm assuming "pref.conf" is a typo?

...and finally where are you implementing this, on an indexer?

somesoni2
SplunkTrust
SplunkTrust

Try this.

props.conf

[syslog]
SEDCMD-ipaddress = s/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/xxxxx/g

no transforms.conf entries.

zerolife
Explorer

thanks for the try. However I rebooted Splunk and it's still not masking incoming syslog

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