Monday, July 29, 2013

Finding the quietest time to do disruptive maintenance with IIS

Some changes to production environments may be much simpler if a little downtime is acceptable (such as migrating hosting providers). Using hard data to find that time to determine the impact on customers is possible using IIS logs and the LogParser tool.

  1. Get hold of the IIS logs from all production servers and copy them into a single folder e.g. 
    • Server1
      • W3SVC1
        • ex12345.log
    • Server2
      • W3SVC1
        • ex12345.log
  2. Download and install LogParser, if you don't have it.
  3. Run the following PowerShell from within the log folder root:
    & 'C:\Program Files (x86)\Log Parser 2.2\LogParser.exe' -i:iisw3c -recurse:-1 "select to_localtime(to_timestamp(date, quantize(time, 3600))) as LocalTimeBlock, count(*) as Count into Logs.csv from *.log where date is not null and `"cs(User-Agent)`" not like '%pingdom%' group by LocalTimeBlock"
    This query converts all dates and times into one hour blocks int local time and excludes requests from Pingdom, which we use for uptime monitoring.
  4. Load the generated Log.csv in Excel and create a scatter plot from the two columns. 


Post a Comment