<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>TomsBlog</title>
    <link>http://www.toms-blog.com/tags/logs/index.xml</link>
    <description>Recent content on TomsBlog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-uk</language>
    <atom:link href="http://www.toms-blog.com/tags/logs/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Create RRD of requests per second from W3c log</title>
      <link>http://www.toms-blog.com/post/create-rrd-of-requests-per-second-from-w3c-log/</link>
      <pubDate>Wed, 09 Oct 2013 20:36:43 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/create-rrd-of-requests-per-second-from-w3c-log/</guid>
      <description>&lt;p&gt;Analysing your Web Server logs be it apache or IIS can be a big task and one well suited for tool such as awstats.&lt;/p&gt;

&lt;p&gt;Awstats gives you a good overall view of traffic and stats for your site but a stat I always want to look at is requests per second as it has a direct correlation to CPU usage etc.&lt;/p&gt;

&lt;p&gt;This will give you a more granular view of traffic and is especially useful for capacity management when it comes to API’s.&lt;/p&gt;

&lt;p&gt;This script will parse your log file count the number of requests in each second and then add the results to an RRD file and produce a graph from that RRD file.&lt;/p&gt;

&lt;p&gt;For this script to work the log file needs to be in the W3c standard format and so each line needs to start with a timestamp in the format yyyy-mm-dd hh:MM:ss.&lt;/p&gt;

&lt;p&gt;It could be easily edited to use a different date format.&lt;/p&gt;

&lt;p&gt;The below example will parse the log file “iislog.log”, create a graph named test.png.&lt;/p&gt;

&lt;p&gt;The –createRRD is specified and so the test.rrd file will be created with a start time of  1320859514.&lt;/p&gt;

&lt;p&gt;The graph will be 500px wide and 300px high with a title of “Requests Per Second”&lt;/p&gt;

&lt;p&gt;./request.pl &amp;ndash;logfile iislog.log &amp;ndash;imageFileName test.png &amp;ndash;rrdfile &amp;ldquo;test.rrd&amp;rdquo; &amp;ndash;rrdGraphOptions &amp;ldquo;--width 500 --height 300 --title &amp;lsquo;Requests Per Second&amp;rsquo;&amp;rdquo; &amp;ndash;createRRD &amp;ndash;startEPOCH 1320859514&lt;/p&gt;

&lt;p&gt;This will produce a graph like below:
&lt;img src=&#34;http://www.toms-blog.com/images/posts/graph-requests-per-second-web-logs/test-requests-per-seconds1.png&#34; alt=&#34;Graph of web requests per second&#34; class=&#34;pure-img&#34;&gt;&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>