Getting Data In

How to mask passwords from splunk logs?

ssyed2009
New Member
time: 20180227120538
... 1 line omitted ...
changetype: modify
replace: userPassword
userPassword: {1234}

Currently, I am trying under props.conf but it doesn't seem to work.

SEDCMD-masking = s/\suserPassword:\s\S+/\suserPassword:\s/################################################/
0 Karma

mdsnmss
SplunkTrust
SplunkTrust

You can try a combination of props.conf and transforms.conf: https://docs.splunk.com/Documentation/Splunk/7.0.2/Data/Anonymizedata

props.conf

[<spec>]
TRANSFORMS-mask = password-masker

transforms.conf

[password-masker]
REGEX = (?m)^(.*)userPassword:\s(\S+)(.*)$
FORMAT = $1userPassword: ################################################$3
DEST_KEY = _raw

ssyed2009
New Member

I tried the above transform and props config and it is modifying the whole event and just showing

userPassword: ################################################

0 Karma

mdsnmss
SplunkTrust
SplunkTrust

Is this your full event you are trying to modify?

time: 20180227120538
... 1 line omitted ...
changetype: modify
replace: userPassword
userPassword: {1234}

It's likely having issues with the multiline format. Try the regex (?s)(.*)userPassword:\s(\S+)(.*)$

0 Karma

mdsnmss
SplunkTrust
SplunkTrust

The SEDCMD is also an option which is what you are attempting. It looks like your regex may be missing for "/g" flag for replacing matches.

0 Karma

mdsnmss
SplunkTrust
SplunkTrust

SEDCMD-masking = s/suserPassword:\s\S+/suserPassword:\s/################################################\1/g

You may also want to reduce the number of "#" if that isn't of importance. You don't want to necessarily make your data size larger.

0 Karma
Get Updates on the Splunk Community!

Modern way of developing distributed application using OTel

Recently, I had the opportunity to work on a complex microservice using Spring boot and Quarkus to develop a ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had 3 releases of new security content via the Enterprise Security ...

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...