H-Sphere traffic_log not updating

bobykus

Well-Known Member
#1
There are visible requests in access log configured via vhost but no traffic
related to web site in H-Sphere traffic_log log

0.4.6.3 - - [03/Oct/2012:13:10:52 +0200] "GET /site/wp-admin/post.php?post=135&action=edit&message=1 HTTP/1.1" 200 21944 "http://...nhagen.dk/site/wp-admin/post.php?post=135&action=edit&message=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1"
0.4.6.3 - - [03/Oct/2012:13:10:56 +0200] "GET /site/wp-admin/admin-ajax.php?action=oembed-cache&post=135 HTTP/1.1" 200 21 "http://...nhagen.dk/site/wp-admin/post.php?post=135&action=edit&message=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1"

# tail -f traffic_log
1349259007 2.7.2.6 36 177
1349259007 2.7.2.6 30 177
1349259009 2.7.2.6 38 712
1349259020 2.7.2.6 469 203


Only main IP of web server is there. Should I do some magic passes to let
mod_psoft_traffic collect the stats right?
 

bobykus

Well-Known Member
#2
We use H-Sphere apache configs with litespeed
Logging section looks like


<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

BufferedLogs On

CustomLog /hsphere/local/var/httpd/logs/access_log combined

# Custom Psoft directive to provide logging into traffic_log file
# for VH with redefined CustomLog. Do not change its status!
AlwaysServerLogs on

<IfModule logio_module>
LogFormat "%{%s}t %v %I %O" combinedio
CustomLog /hsphere/local/var/httpd/logs/traffic_log combinedio
</IfModule>
</IfModule>

However the only records I can see is the ones with IP addresses, instead of host names.
Like this

# tail -f traffic_log
1349259007 2.7.2.6 36 177
1349259007 2.7.2.6 30 177
1349259009 2.7.2.6 38 712
1349259020 2.7.2.6 469 203


If I delete log setting records from httpd.conf and set it is litespeed admin like


File Name /hsphere/local/var/httpd/logs/traffic_log
Piped Logger Not Set
Log Format %{%s}t %v %I %O
Log Headers Referrer UserAgent Host None
Rolling Size (bytes) 100M
Keep Days 1
Compress Archive Yes

I have no logs at all.
We are on 2CPU Enterprise license.
 
Last edited:

bobykus

Well-Known Member
#4
Log and log format is defined in in

/hsphere/shared/apache2/conf/httpd.conf

Litespeed is configured

Using Apache Configuration
Load Apache Configuration Yes
Auto Reload On Changes No

Apache Binary Path /hsphere/shared/apache2/bin/httpd.worker
Apache Configuration File /hsphere/local/config/httpd2/httpd.conf


I can PM you /hsphere/shared/apache2/conf/httpd.conf
 

bobykus

Well-Known Member
#6
OK, now I see, the problem is instead of loggin all to /hsphere/shared/apache/logs/traffic_log it write only entries for web sites
which have no TransferLog enabled in virtual host config.
But, all I need is to have a separate log files for virtual hosts and one traffic_log for all to collect traffic statistic. Instead of having records in user logs OR in traffic_log.
As for

LogFormat "%{%s}t %{Host}i %I %O" combinedio


it looks fine now. It write http_host value. But I need

%v The canonical ServerName of the server serving the request.

which is slightly different.
 

NiteWave

Administrator
#7
%v The canonical ServerName of the server serving the request.

which is slightly different.
agree. you may have to put
CustomLog /hsphere/local/var/httpd/logs/traffic_log combinedio
in every virtual host's configuration.
 

NiteWave

Administrator
#9
%%%
I did some tests for"%v" under pure apache, it acts like litespeed: virtualhost's server name not showing there --- since my test env not good today, it may be wrong. it's best you can work out a test case which I can reproduce it.

according http://www.psoft.net/HSdocumentation/sysadmin/web_traffic_calculation.html#built-in_traffic
Since version 2.5, H-Sphere introduces the mod_psoft_traffic module to write a more informative and convenient traffic log into the /hsphere/local/var/httpd/logs/traffic_log file. Traffic log has the following format:

<unix_timestamp> <domain_name> <incoming_traffic> <outgoing_traffic>
my conclusion so far, without this H-Sphere specific module mod_psoft_traffic, %v won't be able to convert to virtual host's server name in server level section of httpd.conf.

if so, there may be no other better way than every virtual host to include "CustomLog /hsphere/local/var/httpd/logs/traffic_log combinedio" to mimic this H-Sphere's behavior.
 
Last edited:

bobykus

Well-Known Member
#10
Dear Nite,

Looks like you suggestion about put log to vhosts works.
So I'll try it on live servers, if there will be no issues in regards to
performance etc it could be the workaround! I'll let ya know Monday.
Thank you for your efforts!
 
Top