<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unable to mask data with regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-with-regex/m-p/438165#M124729</link>
    <description>&lt;P&gt;Example Log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CEF:0|WAF|SIEMintegration|1|1|Normal|0| fileId=989000730114151753 sourceServiceName=website.com postbody=first_name\=XXXXXX&amp;amp;last_name\=XXXX&amp;amp;shipping_first_name\=ABCDE&amp;amp;shipping_last_name\=EFGHI&amp;amp;record_number\=123412345
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am having trouble getting my regex in transforms.conf to mask:&lt;BR /&gt;
1. shipping_first_name &lt;BR /&gt;
2. shipping_last_name&lt;BR /&gt;
3. record_number&lt;/P&gt;

&lt;P&gt;Transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[record-anonymizer]
REGEX = (?m)^(.*)record_number..\d{2,}$
FORMAT = $1rn=##
DEST_KEY = _raw

[first-name-anonymizer]
REGEX = (?m)^(.*)shipping_first_name..(\w{2,})&amp;amp;$
FORMAT = $1fn=##$
DEST_KEY = _raw

[last-name-anonymizer]
REGEX = (?m)^(.*)shipping_last_name..(\w{2,})&amp;amp;$
FORMAT = $1ln=##$
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Test]
TRANSFORMS-anonymize = record-anonymizer, first-name-anonymizer, last-name-anonymizer
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Sep 2020 00:20:28 GMT</pubDate>
    <dc:creator>cborchgrevink</dc:creator>
    <dc:date>2020-09-30T00:20:28Z</dc:date>
    <item>
      <title>Unable to mask data with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-with-regex/m-p/438165#M124729</link>
      <description>&lt;P&gt;Example Log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CEF:0|WAF|SIEMintegration|1|1|Normal|0| fileId=989000730114151753 sourceServiceName=website.com postbody=first_name\=XXXXXX&amp;amp;last_name\=XXXX&amp;amp;shipping_first_name\=ABCDE&amp;amp;shipping_last_name\=EFGHI&amp;amp;record_number\=123412345
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am having trouble getting my regex in transforms.conf to mask:&lt;BR /&gt;
1. shipping_first_name &lt;BR /&gt;
2. shipping_last_name&lt;BR /&gt;
3. record_number&lt;/P&gt;

&lt;P&gt;Transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[record-anonymizer]
REGEX = (?m)^(.*)record_number..\d{2,}$
FORMAT = $1rn=##
DEST_KEY = _raw

[first-name-anonymizer]
REGEX = (?m)^(.*)shipping_first_name..(\w{2,})&amp;amp;$
FORMAT = $1fn=##$
DEST_KEY = _raw

[last-name-anonymizer]
REGEX = (?m)^(.*)shipping_last_name..(\w{2,})&amp;amp;$
FORMAT = $1ln=##$
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Test]
TRANSFORMS-anonymize = record-anonymizer, first-name-anonymizer, last-name-anonymizer
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-with-regex/m-p/438165#M124729</guid>
      <dc:creator>cborchgrevink</dc:creator>
      <dc:date>2020-09-30T00:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to mask data with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-with-regex/m-p/438166#M124730</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_sourctype]
[source::/path/to/my/logs]
SEDCMD-remove_secret_data = regex`enter code here
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 May 2019 22:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-with-regex/m-p/438166#M124730</guid>
      <dc:creator>pruthvikrishnap</dc:creator>
      <dc:date>2019-05-02T22:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to mask data with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-with-regex/m-p/438167#M124731</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;i tried to use your regex with regex101 and they do not match correctly. What you want, is a regex that captures everything up to the string you want to mask, and everything behind. Then, in the FORMAT field you use the first capture group, set your mask in the middle and use the secodn capture group.&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[record-anonymizer]
REGEX = (?m)^(.*)record_number\\\=\d+(.*)$
FORMAT = $1record_number=##$2
DEST_KEY = _raw

[first-name-anonymizer]
REGEX = (?m)^(.*)shipping_first_name\\\=\w+(&amp;amp;.*)$
FORMAT = $1shipping_first_name=##$2
DEST_KEY = _raw

[last-name-anonymizer]
REGEX = (?m)^(.*)shipping_last_name\\\=\w+(&amp;amp;.*)$
FORMAT = $1shipping_last_name=##$2
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Greetings&lt;BR /&gt;
Tom&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 10:45:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-with-regex/m-p/438167#M124731</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2019-05-03T10:45:06Z</dc:date>
    </item>
  </channel>
</rss>

