Last active
December 20, 2017 14:56
-
-
Save petrosmm/4bf7bf9f2995ec42bd8432e985e60f2f to your computer and use it in GitHub Desktop.
IIS Errors SQL script using Log Parser with Site Id and local DateTime showing only results from current day
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT EXTRACT_SUFFIX(EXTRACT_PATH(LogFilename), 0, '\W3SVC') as Site, TO_LOCALTIME(TO_TIMESTAMP(date, time)) AS [datetime], [LogFilename], [LogRow], [c-ip], [cs-username], [s-sitename], [s-computername], [s-ip], [s-port], [cs-method], [cs-uri-stem], [cs-uri-query], [sc-status], [sc-substatus], [sc-win32-status], [sc-bytes], [cs-bytes], [time-taken], [cs-version], [cs-host], [cs(User-Agent)], [cs(Cookie)], [cs(Referer)], [s-event], [s-process-type], [s-user-time], [s-kernel-time], [s-page-faults], [s-total-procs], [s-active-procs], [s-stopped-procs] | |
/* remove columns: [date], [time], */ | |
FROM '[LOGFILEPATH]' | |
WHERE | |
TO_STRING(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 'dd') = TO_STRING(SYSTEM_DATE(), 'dd') AND | |
[sc-status] NOT BETWEEN 200 AND 399 | |
ORDER BY datetime desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment