Programming

Using Log Parser Studio to Find Common 500 Errors

Posted on

The following Log Parser Studio query will find common erroring URLs. You could adapt this to find common addresses for other status codes too. SELECT TOP 20 cs-uri-stem, COUNT(*) AS Total, MAX(time-taken) AS MaxTime, AVG(time-taken) AS AvgTime FROM ‘[LOGFILEPATH]’ WHERE date > SUB(TO_LOCALTIME(SYSTEM_TIMESTAMP()), TIMESTAMP(‘0000-01-02 00:00’, ‘yyyy-MM-dd HH:mm’)) AND sc-status = ‘500’ GROUP BY cs-uri-stem ORDER […]

Programming

Use Log Parser Studio To Get List Of Top IP Ranges

Posted on

If you are getting suspicious traffic, it often comes from a range of IP addresses. The below queries get the count using the first three octets of an IP address, so for “192.168.0.1” it will return “192.168.0” and a count of all traffic for the 192.168.0.1/24 range (192.168.0.1 – 192.168.0.255). To get the first three […]

Programming

Log Parser Studio Custom IIS Log Queries

Posted on

If you want to add my set of Log Parser Studio custom queries to your LPS library, follow these instructions… Note: if you want to merge these with your existing queries, just copy the inner nodes into your LPS library file – if you just want to use my custom set without searching through the […]

Windows

Add X-Forwarded-For IP Address to IIS Logs

Posted on

If you are using a load balancer, the chances are your IIS Logs are full of entries with the IP address of your load balancer, rather than the IP address of your end user. Most load balancers will allow you to send the IP address in an alternate header, for example the X-Forwarded-For header. This […]

Programming

Using Log Parser Studio To Find User Agents

Posted on

If you want to find out which user agents are used to visit your site, you can use the below query. You can use this to find out about browsers, and honest-ish robots (i.e. ones that identify themselves via the user agent). SELECT cs(User-Agent), count(cs(User-Agent)) as requestcount FROM ‘[LOGFILEPATH]’ WHERE date = ‘2016-08-02’ GROUP BY […]

Programming

Using Log Parser Studio to Get Request By Host Name

Posted on

I am working on an application that accepts request for many different domain names, and sends back different content for each one. This means there is one log file for multiple logical sites, because they all run within the same instance of the web application. To make diagnostics easier, I have enabled the “cs-host” column […]