<?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 Masking multiple credit card number for a specific field using SEDCMD in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Masking-multiple-credit-card-number-for-a-specific-field-using/m-p/555432#M91997</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have an event where i would like to mask credit card number only within below two fields using SEDCMD only.&lt;/P&gt;&lt;P&gt;i.e.&amp;nbsp;"PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Name&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;"PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Value"&lt;/P&gt;&lt;P&gt;If i just use&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex mode=sed "s/(\d{4}){3}(\d{4})/xxxx-xxxx-xxxx-\2/g&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;this will check for match in whole event and mask values which it should not mask &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so am testing with below snippet code something like this :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| gentimes start=-1&lt;BR /&gt;| eval myevent="PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Name:[\"6011111111111117\",\"6011000990139424\",\"4111111111111111\",\"5555555555554444\",\"5105105105105100\",\"38520000023237\"]"&lt;BR /&gt;| table&amp;nbsp;myevent&lt;BR /&gt;| rename&amp;nbsp;myevent as new&lt;BR /&gt;| eval old=new&lt;BR /&gt;| rex mode=sed "s/(,.*DetectedValues{}.*\:\[\")(\d{4}){3}(\d{4})/xxxx-xxxx-xxxx-\2/g"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;expected outcome: like this for one of field but should do similar for other field as well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Name":["xxxxxxxxxxxx1117","xxxxxxxxxxxx9424","xxxxxxxxxxxx1111","xxxxxxxxxxxxx4444","5xxxxxxxxxxxx5100","xxxxxxxxxxxx3237"]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jun 2021 05:53:00 GMT</pubDate>
    <dc:creator>anupt1986</dc:creator>
    <dc:date>2021-06-11T05:53:00Z</dc:date>
    <item>
      <title>Masking multiple credit card number for a specific field using SEDCMD</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Masking-multiple-credit-card-number-for-a-specific-field-using/m-p/555432#M91997</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have an event where i would like to mask credit card number only within below two fields using SEDCMD only.&lt;/P&gt;&lt;P&gt;i.e.&amp;nbsp;"PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Name&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;"PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Value"&lt;/P&gt;&lt;P&gt;If i just use&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex mode=sed "s/(\d{4}){3}(\d{4})/xxxx-xxxx-xxxx-\2/g&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;this will check for match in whole event and mask values which it should not mask &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so am testing with below snippet code something like this :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| gentimes start=-1&lt;BR /&gt;| eval myevent="PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Name:[\"6011111111111117\",\"6011000990139424\",\"4111111111111111\",\"5555555555554444\",\"5105105105105100\",\"38520000023237\"]"&lt;BR /&gt;| table&amp;nbsp;myevent&lt;BR /&gt;| rename&amp;nbsp;myevent as new&lt;BR /&gt;| eval old=new&lt;BR /&gt;| rex mode=sed "s/(,.*DetectedValues{}.*\:\[\")(\d{4}){3}(\d{4})/xxxx-xxxx-xxxx-\2/g"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;expected outcome: like this for one of field but should do similar for other field as well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"PolicyDetails{}.Rules{}.ConditionsMatched.SensitiveInformation{}.SensitiveInformationDetections.DetectedValues{}.Name":["xxxxxxxxxxxx1117","xxxxxxxxxxxx9424","xxxxxxxxxxxx1111","xxxxxxxxxxxxx4444","5xxxxxxxxxxxx5100","xxxxxxxxxxxx3237"]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 05:53:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Masking-multiple-credit-card-number-for-a-specific-field-using/m-p/555432#M91997</guid>
      <dc:creator>anupt1986</dc:creator>
      <dc:date>2021-06-11T05:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Masking multiple credit card number for a specific field using SEDCMD</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Masking-multiple-credit-card-number-for-a-specific-field-using/m-p/555444#M91999</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;You can define the field which your rex command will be applied using the "field" command.&lt;BR /&gt;For your example, try replacing your last line for the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed field=new "s/(\d{4}){3}(\d{4})/xxxx-xxxx-xxxx-\2/g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 07:23:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Masking-multiple-credit-card-number-for-a-specific-field-using/m-p/555444#M91999</guid>
      <dc:creator>danielcj</dc:creator>
      <dc:date>2021-06-11T07:23:47Z</dc:date>
    </item>
  </channel>
</rss>

