During the past 2 weeks, we’ve been hacked at work. SQL injection was the method used and it gave us a little headache at the beginning, but I’ve written a script removing the extra string added in every fields of affected tables. Luckily, it affected only one database on the server. We are now in the process of modifying the code in out pages and there’s heaps to do! Most of the websites are coded in Co ld Fusion few years ago (I am new in the company…), so it’s a pain in the bum, let me tell you…
In the process, I looked through the IIS logfiles using logparser (see at the end for the link) to track down any unusual activities on the website. Log parser is amazingly useful to analyze IIS logfiles.
Once you’ve downloaded and installed logparser 2.2, you can analyze any logfiles generated by IIS.
- In IIS, right-click on the website you wish to analyze the logfiles
- A new window opens; in the ‘Enable Logging’ section, click Properties
- Go in the directory shown at the bottom of this window and copy the logfiles you want into logparser root directory (Usually C:\Program Files\Log Parser 2.2)
- Execute logparser; a command prompt window will open
- It’s time to run queries to analyze the log files!
Log parser commands are just like SQL commands. This
logparser “SELECT DISTINCT date, cs-uri-stem, c-ip, Count(*), AS Hits, FROM ex*.log GROUP BY date, c-ip, cs-uri-stem HAVING Hits>50 ORDER BY date, c-ip, Hots DESC”
will give a list of the how many times an IP address has hit a file on one day. Only hits over 50 will be displayed.
IIS log files are structured by columns with headers. For example, columns c-ip represents the IP address. To know more on what field to display, just open a logfile into notepad and look the headers.
Log Parser 2.2