Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to read the Windows-eventlogItems using GVim? Our application logs errors in the eventlog, it would be nice if I could read them using GVim.

A daily export to file is not an option: it should be instant : error happens, switch to GVim, read details of the last X items.

share|improve this question
up vote 1 down vote accepted

You have to export the events everytime you want to look at them.

Route One: Use wevtutil and logparser to create some .txt

 % wevtutil epl XYZ %TEMP%\log.evtx

Then you install LogParser and use it like this:

 % logparser -i:evt -o:csv "SELECT * INTO %TEMP%\log.csv FROM %TEMP%\log.evtx"

After which you can

 % gvim %TEMP%\log.csv

Note: Replace 'XYZ' in the first line with whatever part of the event log you are interested at, these snippets should get you started.

Check out as well.

Route Two: Use psloglist from Sysinternals and use it like this:

 :%!psloglist -h 1 -o XYZ

where XYZ is the event source (maybe the name of your app). Looks simpler to me.

share|improve this answer
Yes, I am hoping such an export tool exists, with possibility to filter last x items. – Sotto Jan 31 '11 at 17:27
@akira: I thought the events are xml files on Vista/2008 onwards. – paradroid Jan 31 '11 at 19:02
You might take a look at the Vim plugins that automatically translate non-text files when they're opened (e.g., $VIMRUNTIME/plugin/gzip.vim or $VIMRUNTIME/plugin/tarPlugin.vim) and see if you can do all those steps that akira gave automatically. Then all you would have to do is open the eventlog file with gvim and the text version would just appear. – garyjohn Jan 31 '11 at 19:20
@akira: I know that. I was suggesting that it might not be too much work to write one. – garyjohn Jan 31 '11 at 19:35
Thanks! tracking down errors has become much more easier now! something like psloglist is exactly what i was hoping for – Sotto Feb 2 '11 at 22:04

You can export the Event Log to an file. In Windows 7 right click on the event category and choose "Save All Events As". I believe that exists in previous versions of Windows as well. Then you can edit that file with Vim.

share|improve this answer
using vim and clicking around like crazy just does not fit the mentality of a vim user, trust me :) – akira Feb 1 '11 at 8:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .