Categories
Programming Windows

Using Log Parser Studio To Find Guilty IP Addresses From X-Forwarded-For

You may have seen how to find guilty IP addresses in my post Using Log Parser Studio to Find Guilty IP Addresses, but if you have enabled the logging of X-Forwarded-For IP addresses in IIS you may want to use this updated version, which gets the top offending IP addresses based on the X-Forwarded-For header: […]

Categories
Windows

Add X-Forwarded-For IP Address to IIS Logs

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 […]

Categories
Programming Windows

Using Log Parser Studio To Find User Agents

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 […]

Categories
Programming Windows

Poking Around Services Using Commands

Important Note! These commands for Windows Services work if you run Command Prompt as Administrator. List All Services SC QUERY state=all > “C:\Temp\Services.txt” This will drop a text file (because you’re likely to have more information than your command buffer) into the temp folder for your perusal. Start / Stop a Service Start a service… […]

Categories
Programming Windows

Using Log Parser Studio to Get Requests Per Hour or Minute

After a load test of some web servers, I needed to have a look through the IIS logs to find out how many requests per minute were being generated on a specific web farm server. The following Log Parser Studio query will group the results by minute, but you can adjust the QUANTIZE call to […]

Categories
Automation Programming Windows

Intermittent Replication Issue – Distribution Agent Failed to Create Temporary Files

This will seem like a strange issue, because everything will work perfectly well for a period of time – but then it will all go wrong and you’ll get an error such as: Error messages: The distribution agent failed to create temporary files in ‘C:\Program Files\Microsoft SQL Server\110\COM’ directory. System returned errorcode 5. (Source: MSSQL_REPL, […]

Categories
Programming Windows

Using Log Parser Studio to Get Request By Host Name

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 […]

Categories
Programming Windows

Unable to Rebuild Performance Counter Setting from System Backup Store

I was attempting to rebuild performance counters on a Windows Server 2012 machine, using the following command in PowerShell (with elevated rights): lodctr /r But kept getting the error: Error: Unable to rebuild performance counter setting from system backup store, error code is 5PS The simple answer… running the same command in an elevated command […]

Categories
Programming Windows

Using Log Parser Studio to Find Guilty IP Addresses

If you are getting hammered by a robot, you’ll probably want to find out the IP Address of the robot to see if it is a friendly one, or just someone playing with Kali Linux in a far off land. The following Log Parser Studio query will get you a list of your top offenders: […]

Categories
Programming Windows

Set Log Parser Studio Log Paths

Log parser studio has a handy UI for adding log file paths, but if you have a shared hosting server with loads of IIS sites, each logging to a different directory – you’ll want to automate the list of log file paths. Go and find the file named “LPSFolders.tmp”, usually found in “C:\Users\USER-NAME\AppData\Roaming\ExLPT\Log Parser Studio\”. […]