<?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: Unable to mask data using Regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-using-Regex/m-p/438690#M124852</link>
    <description>&lt;P&gt;First of all you are using $1 and $2 in FORMAT. Every $n represents exactly one capture group in your REGEX. So in your FORMAT you use one capture group more than in your REGEX. That can't work obviously. You don't want to capture what you want to change. You want to capture what you want to keep. So what you probably want to do is using something like this.&lt;/P&gt;

&lt;P&gt;REGEX = (.*splunk\[)\d+(\].*)&lt;BR /&gt;
FORMAT = $1####$2&lt;/P&gt;

&lt;P&gt;I tested it and it worked.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Aug 2019 13:59:31 GMT</pubDate>
    <dc:creator>dpeukert</dc:creator>
    <dc:date>2019-08-12T13:59:31Z</dc:date>
    <item>
      <title>Unable to mask data using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-using-Regex/m-p/438689#M124851</link>
      <description>&lt;P&gt;I'm testing the data-mask feature by anonymizing the numbers in the brackets: splunk[&lt;STRONG&gt;9085&lt;/STRONG&gt;] but it's not working&lt;BR /&gt;
Is my regex expression incorrect? (generated using an online tool - &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;)&lt;BR /&gt;
Guide: &lt;A href="https://docs.splunk.com/Documentation/Splunk/6.1.4/Data/Anonymizedatausingconfigurationfiles"&gt;https://docs.splunk.com/Documentation/Splunk/6.1.4/Data/Anonymizedatausingconfigurationfiles&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Sample Log:&lt;BR /&gt;
&lt;CODE&gt;Aug 12 09:22:00 forwarder splunk[9085]: #011Checking default conf files for edits...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Forwarder configurations:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;props.conf:&lt;BR /&gt;
&lt;CODE&gt;[linux_logs]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;TRANSFORMS-anonymize = dhclient-anonymizer&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;transforms.conf:&lt;BR /&gt;
&lt;CODE&gt;[dhclient-anonymizer]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;REGEX = splunk\[(\d+)\]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;FORMAT = $1splunk[####]$2&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;DEST_KEY = _raw&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 09:43:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-using-Regex/m-p/438689#M124851</guid>
      <dc:creator>bdalsania_splun</dc:creator>
      <dc:date>2019-08-12T09:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to mask data using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-using-Regex/m-p/438690#M124852</link>
      <description>&lt;P&gt;First of all you are using $1 and $2 in FORMAT. Every $n represents exactly one capture group in your REGEX. So in your FORMAT you use one capture group more than in your REGEX. That can't work obviously. You don't want to capture what you want to change. You want to capture what you want to keep. So what you probably want to do is using something like this.&lt;/P&gt;

&lt;P&gt;REGEX = (.*splunk\[)\d+(\].*)&lt;BR /&gt;
FORMAT = $1####$2&lt;/P&gt;

&lt;P&gt;I tested it and it worked.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 13:59:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-mask-data-using-Regex/m-p/438690#M124852</guid>
      <dc:creator>dpeukert</dc:creator>
      <dc:date>2019-08-12T13:59:31Z</dc:date>
    </item>
  </channel>
</rss>

