When we write rules and monitors to look at events in the event log…. typically the most common criteria are Event ID and Source. We also have a list of other common event properties to choose from:
However, this list doesn’t always work. For instance – if we add someone to a Global Group in AD…. this might create a Event ID 632 in the security event log on a DC – but possibly we only want to alert on this when the group being modified is "Domain Admins". Somewhere in that event description is the word "Domain Admins".
So – the BEST solution…. is to figure out "which parameter" the Domain Admins falls into. To figure out which parameter is which value isn’t always simple. Here is a resource for security events:
What we can see here is that for event ID 632 – the value of "Domain Admins" will be placed as "Target Account Name" which from the links above… is Parameter 3. Therefore – we could make our rule look like so:
Now…. this works great…. but what if we don’t *know* which parameter is which value? See below for some cool tools on finding even parameters.
One option is to use something like "anywhere in the event description, contains specific text". The problem is – we don’t let you pick "Event Description" in the most common event fields… for GOOD reason.
Before we continue – let me STRESS that using event parameters is the correct way to match on specific lines in an event description wherever possible. If we try and search the entire event description, there is a substantial cost to doing this… from an agent design/performance perspective…. as matching on parameter is the lowest impact. If you match on an event description – this description is localized text and wont work in all locales. By writing a rule that matches on event description…. if you didn’t specify several other criteria… there is a risk that every single event description would be searched, across all agents. Very bad. So keep this in mind…. if you decide to use this.
Ok – warnings aside: Here is how you can use that:
Instead of using a common field, or a parameter – type in a "Parameter name not specified above". At some point, we should document what all is available here.
Your new rule should look like this:
Now…. back to the "right" way to do this…. using event parameters.
Stefan has posted about a tool which allows you to determine the event parameter number and value for just about any event log event, and even XML and CSV files, using LogParser:
Check it out and make MUCH better rules! Thanks Stefan!
Here is an example event that I want to match on:
Event Type: Success Audit
Event Source: Security
Event Category: Account Management
Event ID: 636
Time: 7:46:34 AM
Security Enabled Local Group Member Added:
Member Name: –
Member ID: OPSMGR\test
Target Account Name: Administrators
Target Domain: Builtin
Target Account ID: BUILTIN\Administrators
Caller User Name: kevinhol
Caller Domain: OPSMGR
Caller Logon ID: (0x0,0x16C2B850)
Here is an example command line using LogParser:
C:\Program Files\Log Parser 2.2>Logparser.exe "select top 1 Strings AS Parameters FROM security where EventID=636"
Here is the output:
We can gather a few things from this. Parameters will be delimited by a "|" symbol. The first parameter in this example is "-". We can also gather that this tool does not resolve GUID’s properly, by looking at the second parameter, which is actually. The the "Member ID" value of "OPSMGR\test" which is a domain user account. Lastly – the 3rd parameter, which is what I am looking to match on, is "Administrators".
Even if the tool does not resolve GUID’s, that is of little concern, and the point of using the tool is to determine the parameter values in the first place.
Using LogParser with an exported EVT file:
I want to add another example…. lets say you have an exported log in EVT format – and want to search that log in LogParser:
Logparser.exe -i:EVT "select top 1 Strings AS Parameters FROM ‘C:\Temp\exportedlog.evt’ where EventID=2115"
This will parse a saved EVT export of any log that was copied to C:\Temp
NOTE on Server 2008:
I got notified recently that LogParser threw an error when trying to find event parameters in the Security event log on Windows 2008 Server. As usual – this was caused by UAC getting in the way. Make sure you right click LogParser shortcut and run “As an Administrator” in order to make this work – otherwise it will throw a Syntax error about Strings and TEXTLINE. If you run this “As an Administrator” it worked just fine on 2008 server…. even on x64 version.
Also check out the MOM 2005 Wizard post I wrote – another way to look at events, find parameters, and find all possible events for a known event source: