<?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: How do you replace _raw values for multiple fields? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387147#M69434</link>
    <description>&lt;P&gt;Since all your eval trying to update same field (_raw), only last one would be effective. You can confirm that by running a btool command against that sourcetype.&lt;/P&gt;

&lt;P&gt;Again, These search time mask will only apply if a user is running search on Smart/Verbose mode. If a user is running the search in fast mode, user can still see the original data. If you're OK with that fact, give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[wineventlog]     
 ##DOB mask
 EXTRACT-DOB = \&amp;lt;DateOfBirth\&amp;gt;(?&amp;lt;DateOfBirth&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/DateOfBirth\&amp;gt;
 EVAL-DOB = if(isnull(DateOfBirth),NULL,"##masked##")

 ##SSN mask
 EXTRACT-SSN = \&amp;lt;SSN\&amp;gt;(?&amp;lt;SSN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/SSN\&amp;gt;
 EVAL-SSN = if(isnull(SSN),NULL,"##masked##") 

 ##LicenseNumber mask
 EXTRACT-LicenseNumber = \&amp;lt;LicenseNumber\&amp;gt;(?&amp;lt;LicenseNumber&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/LicenseNumber\&amp;gt;
 EVAL-LicenseNumber = if(isnull(LicenseNumber),NULL,"##masked##") 

 ##VIN mask
 EXTRACT-VIN = \&amp;lt;VIN\&amp;gt;(?&amp;lt;VIN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/VIN\&amp;gt;
 EVAL-VIN = if(isnull(VIN),NULL,"##masked##")

 ##Raw data mask
 EVAL-_raw = replace(_raw,"(\&amp;lt;)(VIN|DateOfBirth|LicenseNumber|SSN)(\&amp;gt;)([^\&amp;lt;]+)", "\1\2\3##masked##")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 01 Apr 2019 21:11:29 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-04-01T21:11:29Z</dc:date>
    <item>
      <title>How do you replace _raw values for multiple fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387146#M69433</link>
      <description>&lt;P&gt;I'm trying to mask multiple fields from the raw results. Only one of the fields ends up masked in the raw. It seems I need to either do one statement that gets them all or something else. I've experimented with using a pattern with pipes and also naming the EVAL-_raw differently like EVAL-_raw1 = and EVAL-raw2 =  but have not found a winning combination. If I only try to mask one value I have no issue, so I believe it has to do with me trying doing the replace on more than one _raw string at once. I'm really hoping there is an answer other than deleting logs out. Any assistance is appreciated. These events are already indexed and I just want to mask the sensitive data at search time via props.conf on SH.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[wineventlog]

##DOB mask
EXTRACT-DOB = \&amp;lt;DateOfBirth\&amp;gt;(?&amp;lt;DateOfBirth&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/DateOfBirth\&amp;gt;
EVAL-DOB = if(isnull(DateOfBirth),NULL,"##masked##")
EVAL-_raw = replace(_raw,"\&amp;lt;DateOfBirth\&amp;gt;(?&amp;lt;DateOfBirth&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/DateOfBirth\&amp;gt;","&amp;lt;DateOfBirth&amp;gt;##masked##&amp;lt;/DateOfBirth&amp;gt;")

##SSN mask
EXTRACT-SSN = \&amp;lt;SSN\&amp;gt;(?&amp;lt;SSN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/SSN\&amp;gt;
EVAL-SSN = if(isnull(SSN),NULL,"##masked##")
EVAL-_raw = replace(_raw,"\&amp;lt;SSN\&amp;gt;[^\&amp;lt;]+\&amp;lt;\/SSN\&amp;gt;","&amp;lt;SSN&amp;gt;##masked##&amp;lt;/SSN&amp;gt;")

##LicenseNumber mask
EXTRACT-LicenseNumber = \&amp;lt;LicenseNumber\&amp;gt;(?&amp;lt;LicenseNumber&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/LicenseNumber\&amp;gt;
EVAL-LicenseNumber = if(isnull(LicenseNumber),NULL,"##masked##")
EVAL-_raw = replace(_raw,"\&amp;lt;LicenseNumber\&amp;gt;[^\&amp;lt;]+\&amp;lt;\/LicenseNumber\&amp;gt;","&amp;lt;LicenseNumber&amp;gt;##masked##&amp;lt;/LicenseNumber&amp;gt;")

##VIN mask
EXTRACT-VIN = \&amp;lt;VIN\&amp;gt;(?&amp;lt;VIN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/VIN\&amp;gt;
EVAL-VIN = if(isnull(VIN),NULL,"##masked##")
EVAL-_raw = replace(_raw,"\&amp;lt;VIN\&amp;gt;[^\&amp;lt;]+\&amp;lt;\/VIN\&amp;gt;","&amp;lt;VIN&amp;gt;##masked##&amp;lt;/VIN&amp;gt;")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387146#M69433</guid>
      <dc:creator>jgbricker</dc:creator>
      <dc:date>2020-09-29T23:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace _raw values for multiple fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387147#M69434</link>
      <description>&lt;P&gt;Since all your eval trying to update same field (_raw), only last one would be effective. You can confirm that by running a btool command against that sourcetype.&lt;/P&gt;

&lt;P&gt;Again, These search time mask will only apply if a user is running search on Smart/Verbose mode. If a user is running the search in fast mode, user can still see the original data. If you're OK with that fact, give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[wineventlog]     
 ##DOB mask
 EXTRACT-DOB = \&amp;lt;DateOfBirth\&amp;gt;(?&amp;lt;DateOfBirth&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/DateOfBirth\&amp;gt;
 EVAL-DOB = if(isnull(DateOfBirth),NULL,"##masked##")

 ##SSN mask
 EXTRACT-SSN = \&amp;lt;SSN\&amp;gt;(?&amp;lt;SSN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/SSN\&amp;gt;
 EVAL-SSN = if(isnull(SSN),NULL,"##masked##") 

 ##LicenseNumber mask
 EXTRACT-LicenseNumber = \&amp;lt;LicenseNumber\&amp;gt;(?&amp;lt;LicenseNumber&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/LicenseNumber\&amp;gt;
 EVAL-LicenseNumber = if(isnull(LicenseNumber),NULL,"##masked##") 

 ##VIN mask
 EXTRACT-VIN = \&amp;lt;VIN\&amp;gt;(?&amp;lt;VIN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/VIN\&amp;gt;
 EVAL-VIN = if(isnull(VIN),NULL,"##masked##")

 ##Raw data mask
 EVAL-_raw = replace(_raw,"(\&amp;lt;)(VIN|DateOfBirth|LicenseNumber|SSN)(\&amp;gt;)([^\&amp;lt;]+)", "\1\2\3##masked##")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Apr 2019 21:11:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387147#M69434</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-04-01T21:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace _raw values for multiple fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387148#M69435</link>
      <description>&lt;P&gt;There is no sense doing this at search time; do it at index-time like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[wineventlog]
SEDCMD-StripPII = s/&amp;lt;(DateOfBirth|SSN|LicenseNumber|VIN)&amp;gt;(.*?)&amp;lt;\/(DateOfBirth|SSN|LicenseNumber|VIN)&amp;gt;/&amp;lt;\1&amp;gt;##masked##&amp;lt;\\\3&amp;gt;/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can do it at search time similarly, like this (but I think that is silly, as it is trivially defeated):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[wineventlog]
EVAL-_raw = replace(_raw,"&amp;lt;(DateOfBirth|SSN|LicenseNumber|VIN)&amp;gt;(.*?)&amp;lt;\/(DateOfBirth|SSN|LicenseNumber|VIN)&amp;gt;", "&amp;lt;\1&amp;gt;###&amp;lt;\\\3&amp;gt;")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Apr 2019 04:54:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387148#M69435</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-02T04:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace _raw values for multiple fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387149#M69436</link>
      <description>&lt;P&gt;Thanks, this was to discover options after ingest other than pipe to delete or export, delete, re-ingest. &lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 12:19:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387149#M69436</guid>
      <dc:creator>jgbricker</dc:creator>
      <dc:date>2019-04-02T12:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace _raw values for multiple fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387150#M69437</link>
      <description>&lt;P&gt;The following props.conf worked in all modes (Verbose, Smart, Fast). It also redacts the data in all display modes such as List or Raw. I know the data will remain on disk and it would be better to do at index time. This is a good option for a quick mask with follow up conversations pending.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[wineventlog]


EXTRACT-DOB = \&amp;lt;DateOfBirth\&amp;gt;(?&amp;lt;DateOfBirth&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/DateOfBirth\&amp;gt;
EVAL-DateOfBirth = if(isnull(DateOfBirth),NULL,"&amp;lt;REDACTED&amp;gt;")


EXTRACT-SSN = \&amp;lt;SSN\&amp;gt;(?&amp;lt;SSN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/SSN\&amp;gt;
EVAL-SSN = if(isnull(SSN),NULL,"&amp;lt;REDACTED&amp;gt;")


EXTRACT-LicenseNumber = \&amp;lt;LicenseNumber\&amp;gt;(?&amp;lt;LicenseNumber&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/LicenseNumber\&amp;gt;
EVAL-LicenseNumber = if(isnull(LicenseNumber),NULL,"&amp;lt;REDACTED&amp;gt;")


EXTRACT-VIN = \&amp;lt;VIN\&amp;gt;(?&amp;lt;VIN&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/VIN\&amp;gt;
EVAL-VIN = if(isnull(VIN),NULL,"&amp;lt;REDACTED&amp;gt;")

#Replace raw

EVAL-_raw = replace(_raw,"&amp;lt;(DateOfBirth|SSN|LicenseNumber|VIN)&amp;gt;([^\&amp;lt;]+)","&amp;lt;\1&amp;gt;&amp;lt;REDACTED&amp;gt;")
EVAL-Message = replace(Message,"(.+)","&amp;lt;REDACTED&amp;gt;")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2019 20:23:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387150#M69437</guid>
      <dc:creator>jgbricker</dc:creator>
      <dc:date>2019-04-03T20:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace _raw values for multiple fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387151#M69438</link>
      <description>&lt;P&gt;Thanks for help! &lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 20:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387151#M69438</guid>
      <dc:creator>jgbricker</dc:creator>
      <dc:date>2019-04-03T20:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do you replace _raw values for multiple fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387152#M69439</link>
      <description>&lt;P&gt;Could you explain why this is not working in fast mode?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 08:03:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-replace-raw-values-for-multiple-fields/m-p/387152#M69439</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2019-10-21T08:03:32Z</dc:date>
    </item>
  </channel>
</rss>

