I downloaded an ebook, Linux Server hacks [O’reilly], hacks #65, “Monitoring Web Traffic in Real Time with httptop. Its quite interesting, you can view the traffic, but in CLI, just a black screen. But you can see who’s hitting your web server up to the second.
Firstly, this is my reference,
You can also download a full ebook from here. The file is quite big, 34MB! But… I found the Window help file version for the ebook!
The server used to setup all this things up is using FreeBSD 4.11, using DirectAdmin control panel. Mod_perl update were managed by DirectAdmin, and it makes my job easier to add additional Perl modules for httptop to works. Httptop need Time::HiRes and File::Tail Module installed to mod perl.
The first thing to do is to create additional information in httpd.conf for my domain, farhanfaisal.com. I just add these 2 additional line in the file. (Find the suitable place your own :D)
CustomLog /var/log/httpd/domains/total_log vhost
LogFormat “%v %h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i”” vhost
“total_log” is a newly created file, where the new log data will dumped into, using these specified format. chmod it to 644.
Then we go to our httptop file. You can get the source code from O’reilly official website, or just download it from here.
In order to make sure the scripts will work, we have to install Time::HiRes module and File::Tail perl module.
cd /usr/ports/devel/p5-DateTime-HiRes
make install clean
cd /usr/ports/devel/p5-File-Tail
make install clean
/usr/local/directadmin/customapache/build mod_perl
I just restarted apache using DirectAdmin control panel, and issue this command to initiate httptop
httptop -f vhost -r 2 /var/log/httpd/domains/total_log
Very intersteing hack.
Thank you for the PDF file 🙂 .