IIS Input Format Examples

Log Parser

IIS Input Format Examples

Top 20 URL's for a Site

Create a chart containing the TOP 20 URL's in the "www.margiestravel.com" web site (assumed to be logging in the IIS log format):
LogParser "SELECT TOP 20 Target, COUNT(*) AS Hits INTO MyChart.gif FROM <www.margiestravel.com> GROUP BY Target ORDER BY Hits DESC" -chartType:Column3D -groupSize:1024x768

Export Errors to SYSLOG

Send error entries in the IIS log to a SYSLOG server:
LogParser "SELECT TO_TIMESTAMP(Date, Time), CASE StatusCode WHEN 500 THEN 'emerg' ELSE 'err' END AS MySeverity, HostName AS MyHostname, Target INTO @myserver FROM <1> WHERE StatusCode >= 400" -o:SYSLOG -severity:$MySeverity -hostName:$MyHostname

Bytes by Extension Chart

Create a pie chart with the total number of bytes generated by each extension:
LogParser "SELECT EXTRACT_EXTENSION(Target) AS Extension, MUL(PROPSUM(BytesReceived),100.0) AS Bytes INTO Pie.gif FROM <1> GROUP BY Extension ORDER BY Bytes DESC" -chartType:PieExploded -chartTitle:"Bytes per extension" -categories:off


© 2004 Microsoft Corporation. All rights reserved.