<?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: Search Time Masking Using Calculated Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537549#M151980</link>
    <description>&lt;P&gt;Yeah, that is true. I've updated my answer. You can try it if the number of # doesn't matter in the replaced text.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jan 2021 05:06:59 GMT</pubDate>
    <dc:creator>manjunathmeti</dc:creator>
    <dc:date>2021-01-28T05:06:59Z</dc:date>
    <item>
      <title>Search Time Masking Using Calculated Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537527#M151969</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;&lt;P&gt;Good day. I am trying to perform &lt;STRONG&gt;search time masking&lt;/STRONG&gt; using a Calculated Field to replace _raw with the required result.&lt;/P&gt;&lt;P&gt;This goes fine for me for my particular data of concern. However, it goes complex somehow when that particular field in the same event has to be masked another way. Citing an example below to explain more clearly.&lt;/P&gt;&lt;P&gt;Masking - &lt;STRONG&gt;16 digits&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2021/01/21 - 01:15 AM &amp;lt;ACT&amp;gt;1234567890123456&amp;lt;/ACT&amp;gt;&lt;/P&gt;&lt;P&gt;Result:&amp;nbsp;2021/01/21 - 01:15 AM &amp;lt;ACT&amp;gt;123456&lt;STRONG&gt;######&lt;/STRONG&gt;3456&amp;lt;/ACT&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I see &lt;STRONG&gt;15 digits&lt;/STRONG&gt; for this field, masking should be &lt;STRONG&gt;5 ##### rather than 6 for 16digits&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Masking - 15 digits&lt;/P&gt;&lt;P&gt;2021/01/25 - 01:15 AM &amp;lt;ACT&amp;gt;987654321012345&amp;lt;/ACT&amp;gt;&lt;/P&gt;&lt;P&gt;Result:&amp;nbsp;2021/01/25 - 01:15 AM &amp;lt;ACT&amp;gt;987654&lt;STRONG&gt;#####&lt;/STRONG&gt;2345&amp;lt;/ACT&amp;gt;&lt;/P&gt;&lt;P&gt;Since the same field, _raw, is being worked on. I reckon this is not possible.&lt;/P&gt;&lt;P&gt;props.conf&lt;/P&gt;&lt;P&gt;[&amp;lt;sourcetype&amp;gt;]&lt;/P&gt;&lt;P&gt;EVAL-&lt;STRONG&gt;_raw&lt;/STRONG&gt; = replace(&lt;STRONG&gt;_raw&lt;/STRONG&gt;,"(\d{6})(\d{5,6})(\d{4})","\1&lt;STRONG&gt;######&lt;/STRONG&gt;\3")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know of your thoughts/suggestions.&lt;/P&gt;&lt;P&gt;Thanks in adv.&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 03:58:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537527#M151969</guid>
      <dc:creator>arielpconsolaci</dc:creator>
      <dc:date>2021-01-28T03:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search Time Masking Using Calculated Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537535#M151973</link>
      <description>&lt;P&gt;hi,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/31016"&gt;@arielpconsolaci&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can use the&amp;nbsp;&lt;FONT size="3"&gt;&lt;STRONG&gt;EVAL&lt;/STRONG&gt; command like below,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[&amp;lt;sourcetype&amp;gt;]
EVAL-_raw = replace(_raw, "(\d{6})\d{5,}(\d{4})", "\1######\2")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you, an upvote/like would be appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 05:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537535#M151973</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-01-28T05:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Search Time Masking Using Calculated Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537540#M151977</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129090"&gt;@manjunathmeti&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;I tried this. However, this does not work. Probably because it is the same field _raw.&lt;/P&gt;&lt;P&gt;I checked as well via btool and it only reads one of the eval calculations for the same sourcetype.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 03:57:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537540#M151977</guid>
      <dc:creator>arielpconsolaci</dc:creator>
      <dc:date>2021-01-28T03:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search Time Masking Using Calculated Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537543#M151978</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2021/01/21 - 01:15 AM &amp;lt;ACT&amp;gt;1234567890123456&amp;lt;/ACT&amp;gt;
2021/01/25 - 01:15 AM &amp;lt;ACT&amp;gt;987654321012345&amp;lt;/ACT&amp;gt;"
| multikv noheader=t
| fields _raw
| rex mode=sed "s/(\d{6})(\d{5,6})(\d{4})/\1######\3/g"&lt;/LI-CODE&gt;&lt;P&gt;How about SEDCMD?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 04:25:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537543#M151978</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2021-01-28T04:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Search Time Masking Using Calculated Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537549#M151980</link>
      <description>&lt;P&gt;Yeah, that is true. I've updated my answer. You can try it if the number of # doesn't matter in the replaced text.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 05:06:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537549#M151980</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-01-28T05:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search Time Masking Using Calculated Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537575#M151992</link>
      <description>&lt;P&gt;Thanks again&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129090"&gt;@manjunathmeti&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to observe that for 16 digits numbers be masked with 6#s between the first 6 digits and last 4 digits.&lt;/P&gt;&lt;P&gt;while for 15 digit numbers, masking should be just 5#s&amp;nbsp;between the first 6 digits and last 4 digits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, with my current config, masking happens with 6#s. I am trying to get and observe 6#s and 5#s respective what is given (16 digit numbers and 15 digit numbers). From testing, this seems not possible. But let me know if otherwise.&lt;/P&gt;&lt;P&gt;Thanks for your time on this.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 07:25:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537575#M151992</guid>
      <dc:creator>arielpconsolaci</dc:creator>
      <dc:date>2021-01-28T07:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search Time Masking Using Calculated Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537576#M151993</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;&amp;nbsp;. That may work but what I am trying to achieve is that a plain search using the index and sourcetype at search time will return masked data accdg. to the rule set. Thus using a calculated field for _raw. Thanks still for the suggestion.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 07:27:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Time-Masking-Using-Calculated-Field/m-p/537576#M151993</guid>
      <dc:creator>arielpconsolaci</dc:creator>
      <dc:date>2021-01-28T07:27:58Z</dc:date>
    </item>
  </channel>
</rss>

