<?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 Re: Masking data using regex during Indexing in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319799#M95584</link>
    <description>&lt;P&gt;Okay, in that case you can (almost) use your original RegEx, just put the 37 in the second capturing group:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^(.*)([+,\s,=,A-Z]37)\d{9}(.*)$
FORMAT = $1$2#########$3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Apr 2017 13:28:45 GMT</pubDate>
    <dc:creator>DMohn</dc:creator>
    <dc:date>2017-04-12T13:28:45Z</dc:date>
    <item>
      <title>Masking data using regex during Indexing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319796#M95581</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;

&lt;P&gt;I am trying to mask account numbers at indexing.&lt;BR /&gt;
So I have the respective entries in props.conf and transforms.conf&lt;/P&gt;

&lt;P&gt;The transforms.conf entry looks like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^(.*)([+,\s,=,A-Z])37\d{9}(.*)$
FORMAT = $1$237#########$3
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is working fine for masking except that it is removing a part of the matched pattern.&lt;BR /&gt;
So my log entry is as below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sysISN=0104B382&amp;amp;TRN=0010FDF1&amp;amp;pf=SYSTEM&amp;amp;gxn=ACCOUNT&amp;amp;gxf=37123456789 HTTP/1.1" 200 31513 112258   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After masking the entry is something below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sysISN=0104B382&amp;amp;TRN=0010FDF1&amp;amp;pf=SYSTEM&amp;amp;gxn=ACCOUNT&amp;amp;gxf7######### HTTP/1.1" 200 31513 112258
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So though ideally the value should have been =37########, the masked value leaves out the =3&lt;BR /&gt;
And this happens for all the combinations. The value of $2 and 3 from teh acoount number gets removed at masking.&lt;/P&gt;

&lt;P&gt;Can any one help me identify the fault and resolve it.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 12:03:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319796#M95581</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2017-04-12T12:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Masking data using regex during Indexing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319797#M95582</link>
      <description>&lt;P&gt;If you want to mask everything that starts with &lt;CODE&gt;=37&lt;/CODE&gt; (no matter what the field is named) you can use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^(.*)(=37)\d{9}(.*)$
FORMAT = $1$2#########$3
DEST_KEY=_raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If the key for the field you want to mask is always named &lt;CODE&gt;gxf&lt;/CODE&gt;you should include that in the regex like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^(.*)(gxf=37)\d{9}(.*)$
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Apr 2017 12:18:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319797#M95582</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2017-04-12T12:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Masking data using regex during Indexing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319798#M95583</link>
      <description>&lt;P&gt;That is not always. Coz I have other data like below :&lt;BR /&gt;
TRI+37123456789&lt;BR /&gt;
acct 37123456789&lt;BR /&gt;
FLG37123456789&lt;/P&gt;

&lt;P&gt;This is why I cannot stick to =37 always.&lt;BR /&gt;
I wanted one regex that will support all of the above data.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 12:37:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319798#M95583</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2017-04-12T12:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Masking data using regex during Indexing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319799#M95584</link>
      <description>&lt;P&gt;Okay, in that case you can (almost) use your original RegEx, just put the 37 in the second capturing group:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^(.*)([+,\s,=,A-Z]37)\d{9}(.*)$
FORMAT = $1$2#########$3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Apr 2017 13:28:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319799#M95584</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2017-04-12T13:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Masking data using regex during Indexing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319800#M95585</link>
      <description>&lt;P&gt;Yeah... That worked.. can you please put this as answer&lt;BR /&gt;
Thank you so much&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 13:48:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Masking-data-using-regex-during-Indexing/m-p/319800#M95585</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2017-04-12T13:48:50Z</dc:date>
    </item>
  </channel>
</rss>

