We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

View Complete Thread
  • Re: Converting IIS Log Time to Local Time

    Feb 09, 2017 07:09 AM|Surath|LINK


    I had a similar requirement, in IIS "time" comes in GMT time. My requirement was to see information in EST time.CS-URI-stem

    The query below converts GMT to EST time. I used To_Time() function and subtracted (with SUB() function) 5 hours from GMT, as EST is 5 hour behind of GMT.

     .\LogParser.exe -i:IISW3C "select top 30 CS-URI-stem as URI, time-taken, time as GMT-Time, TO_Time(sub(time,timestamp('05:00:00','hh:mm:ss'))) AS EST-Time from 'C:\Folder\Customer\*.log' order by time-taken DESC" -rtp:-1

    Output Example :

    URI Time-taken GMT-Time EST-Time
    /IE-EN/Pages/default.aspx 2703641 19:45:22 14:45:22
    /Documents/somevideo.mp4 2701075 13:40:52 8:40:52
    /Pages/default.aspx 1036878 16:01:56 11:01:56
    /hr-files/my/shared+document/photos.zip 1005513 14:34:55 9:34:55