Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i export my event logs to a folder (csv or txt) on every start up automatically?

I was looking for either a batch file, powerscript (not really good with yet)or any way to have my event logs exported to txt or csv on every start up? Im using windows 7 pro if that helps

like image 810
ShaadShaad Avatar asked Sep 09 '14 19:09

ShaadShaad


People also ask

Can you export Event Viewer logs?

Exporting Event Viewer Logs Click on the Search icon in the Windows tray and type Event Viewer, click once it appears in the Search window. Expand Windows Logs. Click on the System located in the left pane. Save as Systemlogs on Desktop.

Where do event logs get stored?

By default, Event Viewer log files use the . evt extension and are located in the %SystemRoot%\System32\winevt\Logs folder. Log file name and location information is stored in the registry.

How do I collect Microsoft Event Viewer logs?

Open "Event Viewer" by clicking the "Start" button. Click "Control Panel" > "System and Security" > "Administrative Tools", and then double-click "Event Viewer" Click to expand "Windows Logs" in the left pane, and then select "Application". Click the "Action" menu and select "Save All Events As".


2 Answers

This will output last 20 system event logs in eventlog.txt.Not sure what exactly you need from eventlog - it's a big place...

WEVTUtil query-events System /count:20 /rd:true /format:text > eventlog.txt

You can change System to Application,Security or Setup - not sure what exactly you need.

more info: http://ss64.com/nt/wevtutil.html

check also this: http://ss64.com/nt/psloglist.html

You can save this (or similar) command to bat file and schedule it on start-up

like image 196
npocmaka Avatar answered Oct 05 '22 11:10

npocmaka


WEVTUtil query-events System /count:20 /rd:true /format:text > exported_file_name.csv /q:"Event[System[(EventID=1074)]]"

Then gpedit.msc - windows settings - scripts and add to start up. Thanks @npockmaka for getting this started

like image 36
ShaadShaad Avatar answered Oct 05 '22 10:10

ShaadShaad