Wednesday, January 13, 2016

ubuntu - Apache log general analyzer with vhosts




I'm using Apache in Ubuntu with several vhosts created, all pointing to the same access log. I'm already login the virtual host domain.



I'm looking for a way to have statistics reports that shows information of all vhosts in the same report, something like:




vhosts ------ visits



domain1.net --- 3




domain2.net --- 8




I already check tools like awstats, webalizer, goaccess and others, but I only can get from them separated reports per vhost or only one report including all vhosts as if they were only one.



I checked another answers like tool for analyzing apache logs, A software to analyze Apache log is needed and https://serverfault.com/questions/296316/web-log-analyzer-that-can-generate-a-single-report-for-multiple-domains but doesn't solve my needs either.



Take in consideration that I doesn't want reports like I get from awstats (after some configuration) for all my vhosts resources, I want to check the differences between vhosts.



My log format is (can be changed if needed):




LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\""


And the log looks like:




test.leticia.net:80 127.0.0.1 - - [28/May/2013:12:23:25 -0300] "GET
/test.php HTTP/1.1" 200 301 "-" "Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93

Safari/537.36"



test.leticia.net:80 127.0.0.1 - - [28/May/2013:12:26:30
-0300] "GET /test.php HTTP/1.1" 200 301 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93
Safari/537.36"




Just let me know if another information is required. Thanks in advanced.


Answer



For archive purpose:




I found that webalizer has a section where I can check the Hits, Files, KBytes and Visits of the list of vhosts in my Apache. The section is "[Sites]"



Just be sure of use a LogFormat that includes the vhost, for example:



LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined


The log appears as:




enter image description here


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...