git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Query windows event log with python


On 13/01/2013 05:55, robey.lawrence at gmail.com wrote:
> On Saturday, January 12, 2013 8:34:01 PM UTC+11, Tim Golden wrote:
>> On 12/01/2013 06:09, email.address at gmail.com wrote:
>> 
>>> I am looking to write a short program to query the windows event
>> 
>>> log.
>> 
>>> 
>> 
>>> It needs to ask the user for input for The event type (Critical,
>> 
>>> Error, and Information), and the user needs to be able to specify
>>> a
>> 
>>> date since when they want to view results.
>> 
>>> 
>> 
>>> I found this piece of code to start from,
>> 
>> 
>> 
>> [... snip ...]
>> 
>> 
>> 
>> Well it looks like you have everything you need. Was there a
>> specific
>> 
>> question you wanted to ask?
>> 
>> 
>> 
>> TJG
> 
> yes, I would like to run it in Command prompt and ask the user at the
> time what type and date of Event they would like to view. so i was
> wondering where in the code I could put something like
> "var=raw_input"

Ok, so your query isn't so much with accessing the event log as
with writing Python code at all. If you haven't already, could I suggest
the Python tutorial here:

  http://docs.python.org/2/tutorial/

or, if that one doesn't suit, just search for "Python tutorial" to find
something which fits your brain.

Feel free to post back here with questions once you've got started.

TJG