Solved

Log Parser and finding Specifc Event ID's

Posted on 2010-09-01
11
3,690 Views
Last Modified: 2013-12-04
I recently started playing around with Log Parser in an attempt to export specific login / logoff events to a txt file, which I will then use for data reporting later.

However, I am not finding the correct syntax, or am placing the incorrect syntax to find what I would like to see for results.

I would like to see the username that logs in, time / date they logged in, and the same for logging off.

Here is the syntax I have tried to use:

logparser "select timegenerated, sourcename, eventcategoryname into report.txt from security where eventid = 4624" -resolvesids:on

The .txt file results are this:

TimeGenerated       SourceName                          EventCategoryName
------------------- ----------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2010-08-27 16:47:24 Microsoft-Windows-Security-Auditing The name for category 12544 in Source "Microsoft-Windows-Security-Auditing" cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer

for every event it creates.

what is the query syntax I need to get the data I am looking for?  I am running Server 2008 r2.
0
Comment
Question by:dzirkelb
  • 3
  • 3
11 Comments
 
LVL 22

Expert Comment

by:Paka
Comment Utility
It's likely that logparser is actually finding the right events, but there's a problem with the registry entries for the 4624 event.  

Try:
logparser "select  eventid, timegenerated, sourcename, eventcategoryname into report.txt from security where eventid = 4624" -resolvesids:on

If it returns 4624 events as shown from the first column, our next step will be to figure out why the events aren't logging correctly.
0
 

Author Comment

by:dzirkelb
Comment Utility
EventID TimeGenerated       SourceName                          EventCategoryName
------- ------------------- ----------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4624    2010-09-02 21:13:10 Microsoft-Windows-Security-Auditing The name for category 12544 in Source "Microsoft-Windows-Security-Auditing" cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer

That is the results from your suggestion.
0
 
LVL 22

Expert Comment

by:Paka
Comment Utility
It looks like logparser is pulling data from the security log correctly.  Usually the generic event message means that either the application that is writing the 4624 events is poorly written and won't log the information or the registry is corrupt.  Do you know what application is writing these events?

What data are you trying to get from the security logs?
0
Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

 

Author Comment

by:dzirkelb
Comment Utility
I am running the log parser on a 2008 r2 primary domain controller.  The application that is logging this information would be the default for domain controllers and active directory.

I am trying to create logs of when users logged in and out of their computer to use for reporting.
0
 
LVL 22

Accepted Solution

by:
Paka earned 500 total points
Comment Utility
Try using wevtutil instead of logparser for W2008:
http://blogs.msdn.com/ericfitz/archive/2008/07/16/wevtutil-scripting.aspx
0
 

Author Comment

by:dzirkelb
Comment Utility
I tried the following per the article and it outputs an xml file with no data, do I have the task or event id or logontype wrong?  This is all in a .bat file:



@echo off

 

REM (C) 2008 Microsoft Corporation

REM All Rights Reserved


set outputfile=%temp%\interactive-logon-events.xml


if "%1" NEQ "" set outputfile=%1

 

REM The next command is all one line and has no carriage returns

REM The only spaces in the XPath are around the AND keywords


wevtutil qe Security /q:"*[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and Task=12544 and (EventID=4624)] and EventData[Data[@Name='LogonType']='2']]" /e:Events > %outputfile%


start %outputfile%


set outputfile=
0
 

Expert Comment

by:Skibo187
Comment Utility
"C:\Program Files\Log Parser 2.2\LogParser.exe" -i:EVT "SELECT * FROM  \\SystemName\Security,\\SystemName2\Security WHERE EventID In (529;534;529)" -resolvesSIDs -o:CSV >> Nameyourfile.csv


save that in a batch file and run it.
FYI- you can change the csv at the end to TXT but I think it will be better useful in csv format, ALSO the * pulls everything u can change that also to a specific tag u want.

Hope this is helpful i know its late, but better late then never...

skibo
0

Featured Post

The curse of the end user strikes again      

You’ve updated all your end user’s email signatures. Hooray! But guess what? They’re playing around with the HTML, adding stupid taglines and ruining the imagery. Find out how you can save your signatures from end users today.

Join & Write a Comment

SHARE your personal details only on a NEED to basis. Take CHARGE and SECURE your IDENTITY. How do I then PROTECT myself and stay in charge of my own Personal details (and) - MY own WAY...
Security measures require Windows be logged in using Standard User login (not Administrator).  Yet, sometimes an application has to be run “As Administrator” from a Standard User login.  This paper describes how to create a shortcut icon to launch a…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now