Getting Data In

Anonymize -p password

narenpalepu
New Member

I need to anonymize -p passwords that are appearing in syslog.

Used
props.conf
[syslog_log_control]
source::/var/log/syslog
TRANSFORMS = auth-password-anonymizer

transforms.conf
auth-password-anonymize]
REGEX = -p [0-9A-Za-z]\w{9,255}
FORMAT = $1-p =########$2
DEST_KEY = _raw

I am seeing syslog Cannot parse into key-value pair errors

02-01-2018 00:17:29.320 +0000 WARN ProcessTracker - (child_183__Fsck) IniFile - /opt/splunk/etc/slave-apps/_cluster/local/props.conf, line 95: Cannot parse into key-value pair: source::/var/log/syslog

Please advise

Thanks,

NP

0 Karma
1 Solution

micahkemp
Champion

You have no capture groups defined in your regex, and thus $1 and $2 can't be used. Try this:

REGEX = ^(.*)-p [0-9A-Za-z]\w{9,255}(.*?)$
FORMAT = $1-p ########$2

Though it may make sense to use SEDCMD here instead, because you can more easily replace part of a string (instead of rewriting the entire string from components, as you're doing above).

In props.conf:

[syslog_log_control]
SEDCMD-anonymize = s/-p [0-9A-Za-z]\w{9,255}/-p ########/

View solution in original post

narenpalepu
New Member

Thanks a lot to both .

props.conf
[source::/var/log/syslog]
TRANSFORMS = auth-password-anonymizer

transforms.conf
[auth-password-anonymizer]
REGEX = ^(.)-p [0-9A-Za-z]\w{9,255}(.?)$
FORMAT = $1-p ########$2
DEST_KEY = _raw

0 Karma

micahkemp
Champion

You have no capture groups defined in your regex, and thus $1 and $2 can't be used. Try this:

REGEX = ^(.*)-p [0-9A-Za-z]\w{9,255}(.*?)$
FORMAT = $1-p ########$2

Though it may make sense to use SEDCMD here instead, because you can more easily replace part of a string (instead of rewriting the entire string from components, as you're doing above).

In props.conf:

[syslog_log_control]
SEDCMD-anonymize = s/-p [0-9A-Za-z]\w{9,255}/-p ########/

maciep
Champion

are you trying to set the source to /var/log/syslog? Or is that the source you want to apply the transform to? I don't think your props is doing either correctly, which is why I think it's barking at you.

but it also looks like you may have typed that in above or missed some bits during copy/paste, so not sure if that's exactly how your config looks?

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...