Search code examples
javapowershellevent-viewer

How to read Windows Log evt/evtx files using java


I was wondering is there any java library to read evt/evtx files.

Already referred links

How to read .evtx extension file through java program

Reading .evt/.evtx files directly

I found we can use

Get-WinEvent -Path c:\path\to\eventlog.evtx | Export-Csv eventlog.csv

But I need run this in Windows 2003, where PowerShell is not available.


Solution

  • PowerShell v2 is available for Windows Server 2003. Also, there's wevtutil for managing eventlogs from the regular commandline:

    wevtutil query-events Application /c:3 /rd:true /f:text
    

    and LogParser for extracting information from various data sources, including eventlogs and eventlog files:

    logparser -i:EVT -o:CSV "SELECT TOP 3 * FROM exported.evtx"