<?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: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489130#M32036</link>
    <description>&lt;P&gt;2&amp;lt;\/Level&amp;gt; tried this?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jan 2020 05:31:54 GMT</pubDate>
    <dc:creator>ashajambagi</dc:creator>
    <dc:date>2020-01-21T05:31:54Z</dc:date>
    <item>
      <title>Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489124#M32030</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a stanza which looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[WinEventLog://Microsoft-Windows-AppLocker/EXE and DLL]
disabled = 0
renderXml=true
#Block events
whitelist = $XmlRegex='Level="2"'
start_from = oldest
current_only = 0
evt_resolve_ad_obj = 1
checkpointInterval = 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I remove the whitelist I get all the event types. However I only want the Error events. Without the renderXml option, my whitelist would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;whitelist = Type="Error"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when rendered in Xml the event level is rendered like this &lt;CODE&gt;&amp;lt;level&amp;gt;2&amp;lt;/level&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;However, the &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Data/MonitorWindowseventlogdata"&gt;documentation&lt;/A&gt; has only the most basic example of searching for text when using renderXml.&lt;/P&gt;

&lt;P&gt;Does anyone have any experience in advanced syntax for this option? I've tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;whitelist = $XmlRegex='Level="2"'
whitelist = $XmlRegex=Level="2"
whitelist = $XmlRegex="\&amp;lt;Level\&amp;gt;2"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 04:30:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489124#M32030</guid>
      <dc:creator>jeremyhagand61</dc:creator>
      <dc:date>2020-01-20T04:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489125#M32031</link>
      <description>&lt;P&gt;Can you provide a sample event?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 07:09:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489125#M32031</guid>
      <dc:creator>ashajambagi</dc:creator>
      <dc:date>2020-01-20T07:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489126#M32032</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
It's a standard windows event log. Apologies that my link to the Splunk documentation didn't work.  You can see a sample event in here&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Data/MonitorWindowseventlogdata"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/Data/MonitorWindowseventlogdata&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Scroll down to the heading: Display Windows Event Log events in XML&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 07:15:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489126#M32032</guid>
      <dc:creator>jeremyhagand61</dc:creator>
      <dc:date>2020-01-20T07:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489127#M32033</link>
      <description>&lt;P&gt;try using whitelist = $XmlRegex=Event.System.Level=2 &lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 07:44:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489127#M32033</guid>
      <dc:creator>ashajambagi</dc:creator>
      <dc:date>2020-01-20T07:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489128#M32034</link>
      <description>&lt;P&gt;Thanks for your suggestion, but this whitelist didn't work. With the input enabled all events are forwarded. I've tried it as you suggested and have put the "2" in quotes.&lt;/P&gt;

&lt;P&gt;Here is a copy and paste of an actual event:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;xmlns='&lt;A href="http://schemas.microsoft.com/win/2004/08/events/event'%3E"&gt;http://schemas.microsoft.com/win/2004/08/events/event'&amp;gt;&lt;/A&gt; Name='Microsoft-Windows-AppLocker'&lt;BR /&gt;
Guid='{cbda4dbf-8d5d-4f69-9578-be14aa540d22}'/&amp;gt;800204000x8000000000000000 SystemTime='2020-01-20T22:30:09.805334100Z'/&amp;gt;28242 ProcessID='4640'&lt;BR /&gt;
ThreadID='7872'/&amp;gt;Microsoft-Windows-AppLocker/EXE&lt;BR /&gt;
and&lt;BR /&gt;
DLLZPVWMGT01X.dmz.amsa.gov.au UserID='S-1-5-21-3206126476-1968031584-1518185873-1130'/&amp;gt; xmlns='&lt;A href="http://schemas.microsoft.com/schemas/event/Microsoft.Windows/1.0.0.0'%3E3DLL%7Bbac4b0bf-6f1b-40e8-8627-8545fa89c8b6%7D37(Default"&gt;http://schemas.microsoft.com/schemas/event/Microsoft.Windows/1.0.0.0'&amp;gt;3DLL{bac4b0bf-6f1b-40e8-8627-8545fa89c8b6}37(Default&lt;/A&gt; Rule) Microsoft Windows&lt;BR /&gt;
DLLs57D:(XA;;FX;;;S-1-1-0;(APPID://PATH&lt;BR /&gt;
Contains&lt;BR /&gt;
"%WINDIR%*"))S-1-5-21-3206126476-1968031584-1518185873-1130464022%SYSTEM32%\NTMARTA.DLL0117O=MICROSOFT&lt;BR /&gt;
CORPORATION, L=REDMOND, S=WASHINGTON,&lt;BR /&gt;
C=US\MICROSOFT® WINDOWS® OPERATING&lt;BR /&gt;
SYSTEM\NTMARTA.DLL\10.0.17763.010x71c37ca&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 22:35:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489128#M32034</guid>
      <dc:creator>jeremyhagand61</dc:creator>
      <dc:date>2020-01-20T22:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489129#M32035</link>
      <description>&lt;P&gt;Thanks for your suggestion, but it didn't work. Here is a sample of the actual event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'&amp;gt;&amp;lt;System&amp;gt;&amp;lt;Provider Name='Microsoft-Windows-AppLocker' Guid='{cbda4dbf-8d5d-4f69-9578-be14aa540d22}'/&amp;gt;&amp;lt;EventID&amp;gt;8002&amp;lt;/EventID&amp;gt;&amp;lt;Version&amp;gt;0&amp;lt;/Version&amp;gt;&amp;lt;Level&amp;gt;4&amp;lt;/Level&amp;gt;&amp;lt;Task&amp;gt;0&amp;lt;/Task&amp;gt;&amp;lt;Opcode&amp;gt;0&amp;lt;/Opcode&amp;gt;&amp;lt;Keywords&amp;gt;0x8000000000000000&amp;lt;/Keywords&amp;gt;&amp;lt;TimeCreated SystemTime='2020-01-20T22:30:09.805334100Z'/&amp;gt;&amp;lt;EventRecordID&amp;gt;28242&amp;lt;/EventRecordID&amp;gt;&amp;lt;Correlation/&amp;gt;&amp;lt;Execution ProcessID='4640' ThreadID='7872'/&amp;gt;&amp;lt;Channel&amp;gt;Microsoft-Windows-AppLocker/EXE and DLL&amp;lt;/Channel&amp;gt;&amp;lt;Computer&amp;gt;HOSTNAME&amp;lt;/Computer&amp;gt;&amp;lt;Security UserID='S-1-5-21-3206126476-1968031584-1518185873-1130'/&amp;gt;&amp;lt;/System&amp;gt;&amp;lt;UserData&amp;gt;&amp;lt;RuleAndFileData xmlns='http://schemas.microsoft.com/schemas/event/Microsoft.Windows/1.0.0.0'&amp;gt;&amp;lt;PolicyNameLength&amp;gt;3&amp;lt;/PolicyNameLength&amp;gt;&amp;lt;PolicyName&amp;gt;DLL&amp;lt;/PolicyName&amp;gt;&amp;lt;RuleId&amp;gt;{bac4b0bf-6f1b-40e8-8627-8545fa89c8b6}&amp;lt;/RuleId&amp;gt;&amp;lt;RuleNameLength&amp;gt;37&amp;lt;/RuleNameLength&amp;gt;&amp;lt;RuleName&amp;gt;(Default Rule) Microsoft Windows DLLs&amp;lt;/RuleName&amp;gt;&amp;lt;RuleSddlLength&amp;gt;57&amp;lt;/RuleSddlLength&amp;gt;&amp;lt;RuleSddl&amp;gt;D:(XA;;FX;;;S-1-1-0;(APPID://PATH Contains "%WINDIR%\*"))&amp;lt;/RuleSddl&amp;gt;&amp;lt;TargetUser&amp;gt;S-1-5-21-3206126476-1968031584-1518185873-1130&amp;lt;/TargetUser&amp;gt;&amp;lt;TargetProcessId&amp;gt;4640&amp;lt;/TargetProcessId&amp;gt;&amp;lt;FilePathLength&amp;gt;22&amp;lt;/FilePathLength&amp;gt;&amp;lt;FilePath&amp;gt;%SYSTEM32%\NTMARTA.DLL&amp;lt;/FilePath&amp;gt;&amp;lt;FileHashLength&amp;gt;0&amp;lt;/FileHashLength&amp;gt;&amp;lt;FileHash&amp;gt;&amp;lt;/FileHash&amp;gt;&amp;lt;FqbnLength&amp;gt;117&amp;lt;/FqbnLength&amp;gt;&amp;lt;Fqbn&amp;gt;O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US\MICROSOFT® WINDOWS® OPERATING SYSTEM\NTMARTA.DLL\10.0.17763.01&amp;lt;/Fqbn&amp;gt;&amp;lt;TargetLogonId&amp;gt;0x71c37ca&amp;lt;/TargetLogonId&amp;gt;&amp;lt;/RuleAndFileData&amp;gt;&amp;lt;/UserData&amp;gt;&amp;lt;/Event&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 22:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489129#M32035</guid>
      <dc:creator>jeremyhagand61</dc:creator>
      <dc:date>2020-01-20T22:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489130#M32036</link>
      <description>&lt;P&gt;2&amp;lt;\/Level&amp;gt; tried this?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 05:31:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489130#M32036</guid>
      <dc:creator>ashajambagi</dc:creator>
      <dc:date>2020-01-21T05:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489131#M32037</link>
      <description>&lt;P&gt;Well I tried something very similar. Would you need to escape the &amp;lt;&lt;/P&gt;

&lt;P&gt;Like this 2\&lt;/P&gt;

&lt;P&gt;Forward slashes don't require escaping in my experience.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 01:11:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489131#M32037</guid>
      <dc:creator>jeremyhagand61</dc:creator>
      <dc:date>2020-01-22T01:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489132#M32038</link>
      <description>&lt;P&gt;2&amp;lt;\/Level&amp;gt; &lt;/P&gt;

&lt;P&gt;Without the escaping, the regex isn't working&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 05:25:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489132#M32038</guid>
      <dc:creator>ashajambagi</dc:creator>
      <dc:date>2020-01-22T05:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489133#M32039</link>
      <description>&lt;P&gt;Hmm, the web portal mangled my reply.&lt;/P&gt;

&lt;P&gt;Have you tested the above? I tried something very similar (see my OP) and it didn't work.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 05:36:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489133#M32039</guid>
      <dc:creator>jeremyhagand61</dc:creator>
      <dc:date>2020-01-22T05:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489134#M32040</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I've actually just been looking into the same thing. It looks like you need to include a capture group within your regex that will match something in the event.&lt;/P&gt;

&lt;P&gt;I found the best way to get this right the first time round is by starting with a search in Splunk web that includes the regex command to test your regex quickly. Something like the example below should match your event. (Change the index to suit your needs)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | regex _raw="(?&amp;lt;=Level\&amp;gt;)(4)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this works then you know your regex is matching correctly, you should then be able to take that and add it to a blacklist or whitelist depending on what you want&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; whitelist = $XmlRegex = '(?&amp;lt;=Level\&amp;gt;)(4)'
 blacklist = $XmlRegex = '(?&amp;lt;=Level\&amp;gt;)(4)'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also like to use &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; when I'm doing anything with regex, I'd recommend checking it out.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 09:29:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489134#M32040</guid>
      <dc:creator>dan_mcinnes</dc:creator>
      <dc:date>2020-01-22T09:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax of $XmlRegex property for white listing WinEventLog source rendered in XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489135#M32041</link>
      <description>&lt;P&gt;Thanks to @dan_mcinnes for his answer which made me think about testing my regex using Search. The tip about capturing groups wasn't actually needed. It was the escaping of the &lt;CODE&gt;&amp;lt;&lt;/CODE&gt; which was causing it to fail. Actually none of the characters in &lt;CODE&gt;&amp;lt;Level&amp;gt;2&amp;lt;/Level&amp;gt;&lt;/CODE&gt; are special.&lt;/P&gt;

&lt;P&gt;I always thought that unneeded escaping was "safe" so if you escaped a non-special character that it wouldn't affect the match, but it turns out it did.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 22:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Syntax-of-XmlRegex-property-for-white-listing-WinEventLog-source/m-p/489135#M32041</guid>
      <dc:creator>jeremyhagand61</dc:creator>
      <dc:date>2020-01-22T22:01:39Z</dc:date>
    </item>
  </channel>
</rss>

