1

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.

leticia
  • 113
  • 5

2 Answers2

2

You could use a simple shell script to count the number of occurrences of each virtual host:

$ awk '{print $1}' access.log | sort | uniq -c | sort -gr
mgorven
  • 30,036
  • 7
  • 76
  • 121
  • Thanks, all seems that I should use shell scripts as you mention, or a tool like awstats or webalizer with information per vhost. I can't find a tool that show reports centralizing all vhosts. – leticia Jun 03 '13 at 18:48
0

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

leticia
  • 113
  • 5