gnuplot / webplot / access_log (E)
Analyze and count httpd access_log Because an access-log file of Web server becomes very large within A default log-file of Apache (access_log) has following formatted host.domain - - [01/Jan/2000:01:23:45 +0900] "GET /index.html HTTP/1.1" 200 1548 host.domain - - [01/Jan/2000:01:23:50 +0900] "GET /icons/mail.png HTTP/1.1" 200 229 Now let’s count how many accesses are there during 24 hours. What #!/usr/bin/perl while(<>){ if(/.html/){ split; $day = substr($_[3],1,2); $count[$day]++; } } for($i=1;$i<=$#count;$i++){ printf("%10d %10dn",$i,$count[$i]); } In the access_log file, any kinds of Web access such as image files Firstly each line is separated into items (delimiter is This is an example of access statistics to some Web Server 1 172 2 321 3 208 4 279 5 327 .... .... 25 588 26 1038 27 848 28 772 29 570 30 495 31 548 The following shows a graph drawn by gnuplot, dumb terminal. gnuplot> set term dumb Terminal type set to 'dumb' Options are 'feed 79 24' gnuplot> plot "< webplot.pl access_log" with step 1600 ++--------+---------+---------+---------+---------+---------+--------++ + + + + "< webplot.pl access_log" ****** + 1400 ++ *** ++ | * * | | * * | 1200 ++ * * ++ | * * | 1000 ++ *** * * *** ++ | * * * * * * | | * * * * * *** | 800 ++ * * * * * *** ++ | * * *** * * * * | 600 ++ *** * *** * * * * * ++ | *** * * * *** * ***** *** * | | * * * ******* * * * *** | 400 ++ * * * *** *** *** ++ | *** *** * * ***** * * | 200 ++ * ***** *** *** *** ++ | *** | + + + + + + + + 0 ++--------+---------+---------+---------+---------+---------+--------++ 0 5 10 15 20 25 30 35 |