Tag Archives: date

LogParser – Converting IIS logs to local date and time and filtering by date range

This is a note to myself to remember how to convert the UTC date/time to the local timezone.

logparser “SELECT TO_TIMESTAMP(date, time) AS utc-timestamp, TO_LOCALTIME(utc-timestamp) AS local-timestamp,* FROM D:\Log\SearchServiceWrapperLogs\SearchServiceWrapperLogs\u_ex1202* WHERE local-timestamp between timestamp(’2012/02/02 00:00:00′, ‘yyyy/MM/dd hh:mm:ss’) and timestamp(’2012/02/03 00:00:00′, ‘yyyy/MM/dd hh:mm:ss’)” -recurse:-1 -o:csv >> fulllog.csv

Date Ranges in Log Parser for EventLogs

If you need to trawl through your production server event logs. Here’s a quick tip for extracting just the entries for a given date range using LogParser. BTW Visual LogParser is a must have, it even downloads and automatically installs the latest version of LogParer from MS.

SELECT  TimeGenerated, SourceName, ComputerName, Message FROM C:\Downloads\May09-ErrorLog\AppLog\*.evt
WHERE TimeGenerated BETWEEN timestamp(’04/04/2009′, ‘dd/MM/yyyy’) and timestamp(’06/04/2009′, ‘dd/MM/yyyy’)
ORDER BY TimeGenerated desc