Splunk Search

Splunk Light Email Anonymization before Indexing

mseidel
New Member

Hello everybody,

I am new to Splunk and I try to anonymize an email adress of my Logfile with the help of files props.conf and transforms.conf.
I copied the files into the etc/system/local directory and adopt them like this:

props.conf:
[MyLog]
TRANSFORMS-anonymize = email-anonymizer

transforms.conf:
[email-anonymizer]
DEST_KEY = raw
REGEX = ([a-zA-Z0-9
.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+)
FORMAT = *********

This is a row of my sample Logfile:

Oct 26 09:38:24 AAA123 BBB adhjjd adjhah massss@web.de dkjasd adkdsjkd

I stopped Splunk, cleaned the index and started Splunk new. The source name of my Logfile is "MyLog".
Thats what Splunk made out of it:

10/26/17 9:38:24.000 AM *********

I also tried FORMAT=$1*****$2, to concat the strings, but this does not work at all.
Can anybody please give me a hint, what I'm doing wrong or if it is better to use a sed cmd?

Thanks in advance
Mel

0 Karma

mseidel
New Member

Hello everybody,

I helped myself by creating a working sed script.

[MyLog]
SEDCMD-mel = s/([a-zA-Z0-9_.+-]+\@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)/**@**.**/g

I'm quite sure the other way does not work correctly or only for key/value pairs.

Greetings
Mel

0 Karma

Richfez
SplunkTrust
SplunkTrust

mseidel - I changed your snippet to "code" - Hopefully that made the formatting preserved better.

I think it entirely appropriate for you to accept your own answer in this case and collect your karma. 🙂

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...