<?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 to write the transforms.conf for varying password lengths in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-the-transforms-conf-for-varying-password-lengths/m-p/334798#M61902</link>
    <description>&lt;P&gt;Using ONLY the data you provided, this is what you could put in &lt;CODE&gt;props.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host::*]
TRANSFORMS-anonymize1 = nousernameuri
TRANSFORMS-anonymize2 = nopassworduri
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And &lt;CODE&gt;transforms.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[nopassworduri]
REGEX = (?m)^([\s\S]*)password=[^&amp;amp; "]+([\s\S]*)$
FORMAT = $1password=#####$2
DEST_KEY = _raw

[nousernameuri]
REGEX = (?m)^([\s\S]*)username=[^&amp;amp; "]+([\s\S]*)$
FORMAT = $1username=#####$2
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;username&lt;/CODE&gt; and &lt;CODE&gt;password&lt;/CODE&gt; will be a fixed length &lt;CODE&gt;#####&lt;/CODE&gt; and not the same length as the original values.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2017 23:22:06 GMT</pubDate>
    <dc:creator>cpetterborg</dc:creator>
    <dc:date>2017-12-08T23:22:06Z</dc:date>
    <item>
      <title>How to write the transforms.conf for varying password lengths</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-the-transforms-conf-for-varying-password-lengths/m-p/334797#M61901</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Since i am new to Splunk, i'm having hard time understanding and writing the transforms for varying password lengths. It would be great if someone could help me with transforms to mask the username and password. As you may have noticed the password is not of fixed length–it varies for each event.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;SAMPLE DATA:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;192.56.052.10 32.200.12.677, 123.23.234.31 - - [08/Feb/2016:16:41:44 -0500] "GET /login?company=monitorabc34adte1&amp;amp;bplte=&amp;amp;username=admin&amp;amp;password=welcome234 HTTP/1.1" 505 12345 "-" "alexa.com_bot_version_1.4_(&lt;A href="http://www.alexa.com/)" target="_blank"&gt;http://www.alexa.com/)&lt;/A&gt;" "-" "asjenkwqjdqcqwjdncqkwddwc" "-" 0&lt;/P&gt;

&lt;P&gt;192.56.052.10 32.200.12.677, 123.23.234.31 - - [08/Feb/2016:16:41:44 -0500] "GET /login?company=D0110&amp;amp;bplte=&amp;amp;username=grante&amp;amp;password=abc123 HTTP/1.1" 505 12345 "-" "alexa.com_bot_version_1.4_(&lt;A href="http://www.alexa.com/)" target="_blank"&gt;http://www.alexa.com/)&lt;/A&gt;" "-" "asjenkwqjdqcqwjdncqkwddwc" "-" 0&lt;/P&gt;

&lt;P&gt;192.56.052.10 32.200.12.677, 123.23.234.312 - - [08/Feb/2016:16:41:44 -0500] "GET /login?company=1234567u&amp;amp;username=asqwdcfVPOE$rV&amp;amp;password=ssqwerfV78#deQA&amp;amp;tklogin_key=abcdefg123 HTTP/1.1" 302 - "&lt;A href="https://www.google.com/URLredirected/abc" target="_blank"&gt;https://www.google.com/URLredirected/abc&lt;/A&gt;" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) mywebkit/537.36 (KHTML, like appesi) Chrome/62.0.3202.94 Safari/537.36" "-" "asdqwdqwdsfdewwichedf" "-" 0&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:11:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-the-transforms-conf-for-varying-password-lengths/m-p/334797#M61901</guid>
      <dc:creator>kteng2024</dc:creator>
      <dc:date>2020-09-29T17:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the transforms.conf for varying password lengths</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-the-transforms-conf-for-varying-password-lengths/m-p/334798#M61902</link>
      <description>&lt;P&gt;Using ONLY the data you provided, this is what you could put in &lt;CODE&gt;props.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host::*]
TRANSFORMS-anonymize1 = nousernameuri
TRANSFORMS-anonymize2 = nopassworduri
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And &lt;CODE&gt;transforms.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[nopassworduri]
REGEX = (?m)^([\s\S]*)password=[^&amp;amp; "]+([\s\S]*)$
FORMAT = $1password=#####$2
DEST_KEY = _raw

[nousernameuri]
REGEX = (?m)^([\s\S]*)username=[^&amp;amp; "]+([\s\S]*)$
FORMAT = $1username=#####$2
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;username&lt;/CODE&gt; and &lt;CODE&gt;password&lt;/CODE&gt; will be a fixed length &lt;CODE&gt;#####&lt;/CODE&gt; and not the same length as the original values.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 23:22:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-the-transforms-conf-for-varying-password-lengths/m-p/334798#M61902</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-12-08T23:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the transforms.conf for varying password lengths</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-the-transforms-conf-for-varying-password-lengths/m-p/334799#M61903</link>
      <description>&lt;P&gt;Hi @kteng2024,&lt;/P&gt;

&lt;P&gt;You can try below props.conf and transforms.conf&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
TRANSFORMS-anonymize = anopassword, anousername
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[anopassword]
REGEX = (?m)^(.*)(?=password\=)[^\s|&amp;amp;]*(.*)$
FORMAT = $1password=####$2
DEST_KEY = _raw

[anousername]
REGEX = (?m)^(.*)(?=username\=)[^&amp;amp;]*(.*)$
FORMAT = $1username=####$2
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you do not want use transforms.conf then you can achieve same using SEDCMD in props.conf&lt;/P&gt;

&lt;P&gt;So you need to configure props.conf as below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
SEDCMD-maskall = s/(?m)^(.*username\=)[^&amp;amp;]*(.*password\=)[^\s|&amp;amp;]*(.*)$/\1######\2######\3/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Based on sample data I have created below sample query (First 4 lines used to generate dummy data) with sed regex which I have given above&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="192.56.052.10 32.200.12.677, 123.23.234.31 - - [08/Feb/2016:16:41:44 -0500] \"GET /login?company=monitorabc34adte1&amp;amp;bplte=&amp;amp;username=admin&amp;amp;password=welcome234 HTTP/1.1\" 505 12345 \"-\" \"alexa.com_bot_version_1.4_(http://www.alexa.com/)\" \"-\" \"asjenkwqjdqcqwjdncqkwddwc\" \"-\" 0"
| append [ | makeresults| eval _raw="192.56.052.10 32.200.12.677, 123.23.234.31 - - [08/Feb/2016:16:41:44 -0500] \"GET /login?company=D0110&amp;amp;bplte=&amp;amp;username=grante&amp;amp;password=abc123 HTTP/1.1\" 505 12345 \"-\" \"alexa.com_bot_version_1.4_(http://www.alexa.com/)\" \"-\" \"asjenkwqjdqcqwjdncqkwddwc\" \"-\" 0"]
| append [ | makeresults| eval _raw="192.56.052.10 32.200.12.677, 123.23.234.312 - - [08/Feb/2016:16:41:44 -0500] \"GET /login?company=1234567u&amp;amp;username=asqwdcfVPOE$rV&amp;amp;password=ssqwerfV78#deQA&amp;amp;tklogin_key=abcdefg123 HTTP/1.1\" 302 - \"https://www.google.com/URLredirected/abc\" \"Mozilla/5.0 (Windows NT 6.1; Win64; x64) mywebkit/537.36 (KHTML, like appesi) Chrome/62.0.3202.94 Safari/537.36\" \"-\" \"asdqwdqwdsfdewwichedf\" \"-\" 0" ]
| rex mode=sed "s/(?m)^(.*username\=)[^&amp;amp;]*(.*password\=)[^\s|&amp;amp;]*(.*)$/\1######\2######\3/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which is giving result as below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;192.56.052.10 32.200.12.677, 123.23.234.31 - - [08/Feb/2016:16:41:44 -0500] "GET /login?company=monitorabc34adte1&amp;amp;bplte=&amp;amp;username=######&amp;amp;password=###### HTTP/1.1" 505 12345 "-" "alexa.com_bot_version_1.4_(http://www.alexa.com/)" "-" "asjenkwqjdqcqwjdncqkwddwc" "-" 0
192.56.052.10 32.200.12.677, 123.23.234.31 - - [08/Feb/2016:16:41:44 -0500] "GET /login?company=D0110&amp;amp;bplte=&amp;amp;username=######&amp;amp;password=###### HTTP/1.1" 505 12345 "-" "alexa.com_bot_version_1.4_(http://www.alexa.com/)" "-" "asjenkwqjdqcqwjdncqkwddwc" "-" 0
192.56.052.10 32.200.12.677, 123.23.234.312 - - [08/Feb/2016:16:41:44 -0500] "GET /login?company=1234567u&amp;amp;username=######&amp;amp;password=######&amp;amp;tklogin_key=abcdefg123 HTTP/1.1" 302 - "https://www.google.com/URLredirected/abc" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) mywebkit/537.36 (KHTML, like appesi) Chrome/62.0.3202.94 Safari/537.36" "-" "asdqwdqwdsfdewwichedf" "-" 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Harshil&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 05:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-the-transforms-conf-for-varying-password-lengths/m-p/334799#M61903</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-09T05:32:49Z</dc:date>
    </item>
  </channel>
</rss>

