<?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: Index time masking maintaining  string length in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514833#M87215</link>
    <description>&lt;P&gt;great. Let me try this.&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120445"&gt;@cpetterborg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 04:13:17 GMT</pubDate>
    <dc:creator>payl_chdhry</dc:creator>
    <dc:date>2020-08-19T04:13:17Z</dc:date>
    <item>
      <title>Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514705#M87205</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to do masking for logs at index time but the replaced value ("X" here) should be same character length as original string. My requirement for masking is that for the value within [] only last 4 characters should be visible.&lt;/P&gt;&lt;P&gt;Example for below logs:&lt;/P&gt;&lt;P&gt;2020-08-18T13:17:43,990 [Engine 1] TRACE log data V01 [1|12345678]&lt;BR /&gt;2020-08-18T13:17:44,979 [Engine 2] TRACE log data V02 [2|A35453DFDF65]&lt;/P&gt;&lt;P&gt;The indexed logs should be:&lt;/P&gt;&lt;P&gt;2020-08-18T13:17:43,990 [Engine 1] TRACE log data V01 [1|XXXX5678]&lt;BR /&gt;2020-08-18T13:17:44,979 [Engine 2] TRACE log data V02 [2|XXXXXXXXDF65]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I am using SEDCMD command as below but that is taking only static length for X:&lt;BR /&gt;s/(TRACE\slog\s+data\s+V\d+\s+\[\d\|)(\w+)(\w{4})/\1XXXXXX\3/g&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to replace string at index time with another string maintaining the count of&amp;nbsp; characters.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 13:55:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514705#M87205</guid>
      <dc:creator>payl_chdhry</dc:creator>
      <dc:date>2020-08-18T13:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514758#M87209</link>
      <description>&lt;P&gt;Is Length of the string dynamic?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="33FA2DD2-35F3-456B-A0C3-E175B54A71E5.png" style="width: 1125px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10351i6B40E97E815260B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="33FA2DD2-35F3-456B-A0C3-E175B54A71E5.png" alt="33FA2DD2-35F3-456B-A0C3-E175B54A71E5.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 19:30:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514758#M87209</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-18T19:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514811#M87212</link>
      <description>&lt;P&gt;Using the clever regex from&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp;(and slightly modified), here is a SEDCMD that I have tested which works and does what you want:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SEDCMD=s/(?=[^\|]+\w{4}]$)./#/g&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screen Shot 2020-08-18 at 6.26.53 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10354iD0AF247FCF634F9F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-08-18 at 6.26.53 PM.png" alt="Screen Shot 2020-08-18 at 6.26.53 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 00:28:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514811#M87212</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2020-08-19T00:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514830#M87213</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp; yes the length would be dynamic. It should be anywhere between say 8 to maybe 20.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 04:11:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514830#M87213</guid>
      <dc:creator>payl_chdhry</dc:creator>
      <dc:date>2020-08-19T04:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514831#M87214</link>
      <description>&lt;P&gt;SEDCMD-mask = s/\|(\w+)(\w{4}\])$/|#\2/&lt;BR /&gt;&lt;BR /&gt;Why can't we use this one, which has less of a load?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 04:12:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514831#M87214</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-19T04:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514833#M87215</link>
      <description>&lt;P&gt;great. Let me try this.&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120445"&gt;@cpetterborg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 04:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514833#M87215</guid>
      <dc:creator>payl_chdhry</dc:creator>
      <dc:date>2020-08-19T04:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514835#M87216</link>
      <description>&lt;P&gt;No worries &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;, I shared tested regex.&lt;/P&gt;&lt;P&gt;upvote if that solves your problem.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 04:28:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514835#M87216</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-19T04:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514854#M87220</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;&amp;nbsp;that would replace the whole&amp;nbsp; matching string with single #, like below:&lt;/P&gt;&lt;DIV class="shared-page"&gt;&lt;DIV class="main-section-body"&gt;&lt;DIV class="search"&gt;&lt;DIV class="search-results"&gt;&lt;DIV class="tab-content"&gt;&lt;DIV class="tab-pane events-fields-container search-results-eventspane show-fields"&gt;&lt;DIV class="search-results-wrapper"&gt;&lt;DIV class="lazy-view-container lazy-events-viewer shared-eventsviewer-lazyeventsviewer"&gt;&lt;DIV class="shared-eventsviewer"&gt;&lt;DIV class="scrolling-table-wrapper shared-eventsviewer-list"&gt;2020-08-19T07:28:32,032 [Engine 8] TRACE SegmentLocks V13 added [1|A454FFDPP01]&lt;P&gt;To:&lt;/P&gt;&lt;P&gt;2020-08-19T07:28:32,032 [Engine 8] TRACE SegmentLocks V13 added [1|#PP01]&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;My requirement is to replace each character (and not whole string) with X so the count of characters replaced before masking is equal to count of Xs.&lt;/P&gt;&lt;P&gt;2020-08-19T07:28:32,032 [Engine 8] TRACE SegmentLocks V13 added [1|XXXXXXXPP01]&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 07:32:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514854#M87220</guid>
      <dc:creator>payl_chdhry</dc:creator>
      <dc:date>2020-08-19T07:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514858#M87222</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120445"&gt;@cpetterborg&lt;/a&gt;&amp;nbsp;Thank you for this. It worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I had one more query in case you might be able to help. I have same requirement but for different&amp;nbsp; format of string. I am trying to customize this rex/sed for this format as well but not able to achieve it yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2020-08-19T07:42:38,942 [Engine 9] TRACE MEHSegment WHERE "00" "00000123456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;" 1 240&lt;/P&gt;&lt;P&gt;should give me:&lt;/P&gt;&lt;P&gt;2020-08-19T07:42:38,942 [Engine 9] TRACE MEHSegment WHERE "00" "0000012XXXX&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;" 1 240&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 07:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514858#M87222</guid>
      <dc:creator>payl_chdhry</dc:creator>
      <dc:date>2020-08-19T07:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514861#M87223</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/54383"&gt;@payl_chdhry&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;you could upvote my post also, because my post is the source to your answer.&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 08:01:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514861#M87223</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-19T08:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514864#M87224</link>
      <description>&lt;P&gt;Sorry m new to posting here. How do I upvote a post once I have marked anther post as answer.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 08:19:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514864#M87224</guid>
      <dc:creator>payl_chdhry</dc:creator>
      <dc:date>2020-08-19T08:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514884#M87225</link>
      <description>&lt;P&gt;Can you post this as new question?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 09:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514884#M87225</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-19T09:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Index time masking maintaining  string length</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514891#M87227</link>
      <description>&lt;P&gt;just did &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;A href="https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length-continue/m-p/514890#M87226" target="_blank"&gt;https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length-continue/m-p/514890#M87226&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 10:08:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-time-masking-maintaining-string-length/m-p/514891#M87227</guid>
      <dc:creator>payl_chdhry</dc:creator>
      <dc:date>2020-08-19T10:08:59Z</dc:date>
    </item>
  </channel>
</rss>

