<?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 Unable to blacklist Windows events with regex on universal forwarder in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201233#M58311</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;We have an remote DC, to save bandwidth and Splunk license we like to filter out computer account logon messages.&lt;BR /&gt;
Using Splunk UFW 6.2.4&lt;BR /&gt;
EventCode=4624&lt;BR /&gt;
Example eventlog message:&lt;/P&gt;

&lt;P&gt;An account was successfully logged on. Subject: Security ID: NULL SID Account Name: - Account Domain: - Logon ID: 0x0 Logon Type: 3 New Logon: Security ID: NT AUTHORITY\SYSTEM Account Name: DC01$ Account Domain: AAA-BBB Logon ID: 0x2d71a99b Logon GUID: .......&lt;/P&gt;

&lt;P&gt;Account Name is listed twice, if the second Account Name directive is an computer account (ending with a $) the event should be blacklisted and not forwarded to the indexer.&lt;/P&gt;

&lt;P&gt;I added the following to the inputs.conf in de deployment-apps/Splunk_TA_windows/local:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist3 = EventCode="4624" Message="Account\sName:\s.*Account\sName:\s(\S+\$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Why is this not working?&lt;/STRONG&gt;  Tested the regex on &lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt; and it looks fine?&lt;BR /&gt;
Blacklisting just EventCode="4624" is working fine but that’s not what we want.&lt;/P&gt;

&lt;P&gt;Also tried the following, all not working while regex101 shows the regex is ok.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist3 = EventCode="4624" Message="(?:.*?Account Name:){2}\s(\S+)\$"
blacklist3 = EventCode="4624" Message="Account Name:\s(\S+).+Account Name:\s(\S+)\$"
blacklist3 = EventCode="4624" Message="Account\sName:.*Account\sName:\s[\S+]+[\$]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:08:55 GMT</pubDate>
    <dc:creator>Derksr</dc:creator>
    <dc:date>2020-09-29T07:08:55Z</dc:date>
    <item>
      <title>Unable to blacklist Windows events with regex on universal forwarder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201233#M58311</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;We have an remote DC, to save bandwidth and Splunk license we like to filter out computer account logon messages.&lt;BR /&gt;
Using Splunk UFW 6.2.4&lt;BR /&gt;
EventCode=4624&lt;BR /&gt;
Example eventlog message:&lt;/P&gt;

&lt;P&gt;An account was successfully logged on. Subject: Security ID: NULL SID Account Name: - Account Domain: - Logon ID: 0x0 Logon Type: 3 New Logon: Security ID: NT AUTHORITY\SYSTEM Account Name: DC01$ Account Domain: AAA-BBB Logon ID: 0x2d71a99b Logon GUID: .......&lt;/P&gt;

&lt;P&gt;Account Name is listed twice, if the second Account Name directive is an computer account (ending with a $) the event should be blacklisted and not forwarded to the indexer.&lt;/P&gt;

&lt;P&gt;I added the following to the inputs.conf in de deployment-apps/Splunk_TA_windows/local:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist3 = EventCode="4624" Message="Account\sName:\s.*Account\sName:\s(\S+\$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Why is this not working?&lt;/STRONG&gt;  Tested the regex on &lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt; and it looks fine?&lt;BR /&gt;
Blacklisting just EventCode="4624" is working fine but that’s not what we want.&lt;/P&gt;

&lt;P&gt;Also tried the following, all not working while regex101 shows the regex is ok.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist3 = EventCode="4624" Message="(?:.*?Account Name:){2}\s(\S+)\$"
blacklist3 = EventCode="4624" Message="Account Name:\s(\S+).+Account Name:\s(\S+)\$"
blacklist3 = EventCode="4624" Message="Account\sName:.*Account\sName:\s[\S+]+[\$]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:08:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201233#M58311</guid>
      <dc:creator>Derksr</dc:creator>
      <dc:date>2020-09-29T07:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to blacklist Windows events with regex on universal forwarder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201234#M58312</link>
      <description>&lt;P&gt;One problem I see is that you are specifying a single space between "Account Name:" and whatever comes after, but in all my windows event logs I have multiple spaces between "Account Name" and the account name.&lt;/P&gt;

&lt;P&gt;So &lt;BR /&gt;
&lt;CODE&gt;Account\sName:.*Account\sName:\s[\S+]+[\$]&lt;/CODE&gt; might need to be &lt;BR /&gt;
&lt;CODE&gt;Account\sName:.*Account\sName:\s+[\S+]+[\$]&lt;/CODE&gt;.  Can you give that a try on some of your examples and see if it helps?  &lt;/P&gt;

&lt;P&gt;If it doesn't, try limiting your blacklist to either/any of the "Account Name:" ending in $ being blocked, get that working and it should be a simple matter to extend it to the second one.&lt;/P&gt;

&lt;P&gt;And, otherwise, post back with whatever new revelations you've had from those!  &lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2015 13:23:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201234#M58312</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-08-30T13:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to blacklist Windows events with regex on universal forwarder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201235#M58313</link>
      <description>&lt;P&gt;Thanks for your fast response.&lt;/P&gt;

&lt;P&gt;You pointed me in the right direction.&lt;BR /&gt;
I tested my regex against the consolidated message field, not the original Windows Eventlog Message.&lt;BR /&gt;
The original Eventlog Message contains tabs and newline chars.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;An account was successfully logged on.

    Subject:
        Security ID:        NULL SID
        Account Name:       -
        Account Domain:     -
        Logon ID:       0x0

    Logon Type:         3

    New Logon:
        Security ID:        SYSTEM
        Account Name:       DC01$
        Account Domain:     AAA-BBB
    ....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Solved it with the following regex blacklist entry:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist3 = EventCode="4624" Message="Account\sName:.*[\S\s]*Account\sName:\s+[\S+]+[\$]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 30 Aug 2015 21:08:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201235#M58313</guid>
      <dc:creator>Derksr</dc:creator>
      <dc:date>2015-08-30T21:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to blacklist Windows events with regex on universal forwarder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201236#M58314</link>
      <description>&lt;P&gt;Derksr, &lt;/P&gt;

&lt;P&gt;I tried your regex blacklist entry but it did it not work... did it work for you?  Here is how mine look:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist3 = Eventcode="^4624" Message="^Logon\sType:\s+[3]" Message=".*Account\sName:.*[\S\s]*Account\sName:\s+[a-zA-Z0-9-]+[\$]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Nov 2015 19:36:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201236#M58314</guid>
      <dc:creator>kmedina1</dc:creator>
      <dc:date>2015-11-06T19:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to blacklist Windows events with regex on universal forwarder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201237#M58315</link>
      <description>&lt;P&gt;Yes mine worked great.&lt;/P&gt;

&lt;P&gt;I've checked your regex with &lt;A href="https://www.regex101.com/#python"&gt;https://www.regex101.com/#python&lt;/A&gt;  (did you?)&lt;BR /&gt;
The following works for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Message="Account\sName:.*[\S\s]*Logon\sType:\s+[3][\S\s]*Account\sName:\s+[\S+]+[\$]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So 1 message directive.&lt;/P&gt;

&lt;P&gt;Looks like the following is what you want: (watch out for capitals EventCode != Eventcode )&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist3 = EventCode="4624" Message="Account\sName:.*[\S\s]*Logon\sType:\s+[3][\S\s]*Account\sName:\s+[\S+]+[\$]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Nov 2015 20:12:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201237#M58315</guid>
      <dc:creator>Derksr</dc:creator>
      <dc:date>2015-11-06T20:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to blacklist Windows events with regex on universal forwarder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201238#M58316</link>
      <description>&lt;P&gt;Derksr,&lt;/P&gt;

&lt;P&gt;You were right on point... I typed eventcode rather than EventCode. It seems to be working!&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 22:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-blacklist-Windows-events-with-regex-on-universal/m-p/201238#M58316</guid>
      <dc:creator>kmedina1</dc:creator>
      <dc:date>2015-11-06T22:21:43Z</dc:date>
    </item>
  </channel>
</rss>

