title: Read Specific Windows Event Log Event
body: <p>I am working on a program and need ot know how I would read a specific entry to the Windows Event Log based on a Record number, which this script will already have. Below is the code I have been working with, but I don't want to loop through all of the events until I find the one I'm looking for. Any ideas?</p>
  
  <pre><code>import win32evtlog
  
  server = 'localhost' # name of the target computer to get event logs
  logtype = 'System'
  hand = win32evtlog.OpenEventLog(server,logtype)
  flags = win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
  total = win32evtlog.GetNumberOfEventLogRecords(hand)
  
  while True:
      events = win32evtlog.ReadEventLog(hand, flags,0)
      if events:
          for event in events:
              if event.EventID == "27035":
                  print 'Event Category:', event.EventCategory
                  print 'Time Generated:', event.TimeGenerated
                  print 'Source Name:', event.SourceName
                  print 'Event ID:', event.EventID
                  print 'Event Type:', event.EventType
                  data = event.StringInserts
                  if data:
                      print 'Event Data:'
                      for msg in data:
                          print msg
                  break
  </code></pre>