You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Julian Hall <ju...@acris.co.uk> on 2002/07/11 13:50:32 UTC

Strange logging problem

Can anyone help me with this?

I have a rather bizarre problem with logging on my cobalt RaQ4.  I am 
using the latest cobalt-supplied version of apache which is 1.3.20 with 
some patches applied (not sure exactly which ones, to be honest).

I am running several virtual hosts on a single IP using NameVirtualHost. 
 Each host has its own TransferLog, in a custom format set by a 
LogFormat directive.  The format, however, does not make any difference 
to the problem.

The problem is essentially that no entries are stored in the access log 
for each virtual host.  Other information about the system:

- the 'main' access log at /var/log/httpd/access still receives details 
of any requests that don't specify a virtual host.
- whenever an access is made, the time stamp on the relevant log file is 
updated, but no data becomes visible.  the size of the file does not change.
- all of my virtual hosts stopped logging simultaneously (at a time when 
I wasn't in the office, so I don't know what changed to cause this) with 
various sizes of log file.
- the file system is not full, and there are plenty of free inodes.  No 
quotas are in force.
- if I manually append data to one of the files (eg by running 'echo >> 
access_log'), logging will start again in that file, but stop after 1024 
bytes are logged.
- logging generally stops in the middle of a line in the log file
- the only non-standard modules I am using are php & chillisoft ASP.
- the OS is Linux 2.2.16C32_III and the hardware is IA32 platform.
- the virtual host error logs are also affected.

Cut down to its most basic, this is my httpd.conf (with comment lines 
stripped):


LoadModule env_module modules/mod_env.so
LoadModule define_module modules/mod_define.so
LoadModule config_log_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule status_module modules/mod_status.so
LoadModule includes_module modules/mod_include.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule frontpage_module modules/mod_frontpage.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule asis_module modules/mod_asis.so
LoadModule imap_module modules/mod_imap.so
LoadModule action_module modules/mod_actions.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule access_module modules/mod_access.so
LoadModule pam_external_auth_module modules/mod_auth_pam_external.so
LoadModule auth_module modules/mod_auth.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule casp2_module modules/mod_casp2.so
LoadModule php4_module modules/libphp4.so
LoadModule ssl_module modules/libssl.so
AddModule mod_php4.c
ServerType standalone
Port 80
HostnameLookups off
User httpd
Group httpd
ServerAdmin admin@ns.acris.co.uk
ServerRoot /etc/httpd
ErrorLog /var/log/httpd/error
LogLevel notice
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
\"%{User-Agent}i\"" comb
ined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%h;%t;%U;%b;%{Referer}i;%{User-agent}i" acr
LogFormat "%h;%t;%U;%b;%{Referer}i;%{User-agent}i"
CustomLog /var/log/httpd/access combined
PidFile /var/run/httpd.pid
ScoreBoardFile /var/log/httpd/httpd_status
ServerName ns.acris.co.uk
UseCanonicalName off
Timeout 300
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 20
StartServers 5
MaxClients 300
MaxRequestsPerChild 300000
Listen 80
Listen 443
<IfModule mod_ssl.c>
SSLSessionCache         dbm:/var/log/httpd/ssl_scache
SSLSessionCacheTimeout  300
SSLMutex                file:/var/log/httpd/ssl_mutex
SSLRandomSeed startup   file:/dev/urandom 512
SSLRandomSeed connect   builtin
</IfModule>
<Perl>
use Apache::PerlSections();
use Cobalt::Ssl;
my (@ssl_conf,$ip,$group,$rewrite_rules,$proto,$ret);
open(HTTPD_CONF,"/etc/httpd/conf/httpd.conf") ||
    die "What ? We can't read our own configuration file?: $!";
while(<HTTPD_CONF>) {
    if (/^<VirtualHost [\d\.]+>$/ ... /^<\/VirtualHost>$/) {
        if ( /^<VirtualHost ([\d\.]+)>/o ) {
            # New section. Clean up.
            $ip = $1;
            @ssl_conf = ();
            $group = undef;
        }

        # Skip this bit, we don't need it now..
        next if (/^<VirtualHost/);

        # Just need to grab the group name out before we get on with
        # the real work.
        if ( /DocumentRoot \/home\/sites\/([^\/]+)\/web/ ){
            $group = $1;
        }

        # These two are for the rewrite options
        s/http/https/go if (/^Rewrite/);
        s/80/443/go if (/^Rewrite/);
        push @ssl_conf, $_;

        # Hardcoded, issues with mod_perl and cobalt modules.
        if (/^<\/Virtual/ and (-f "/etc/httpd/ssl/$group")) {
            $ret = ssl_cert_check("/home/sites/$group/certs/");
            if ($ret=~/^2/o) {
                $PerlConfig .= "Listen $ip:443\n";
                $PerlConfig .= "<VirtualHost $ip:443>\n";
                $PerlConfig .= "SSLengine on\n";
                $PerlConfig .= "SSLCertificateFile 
/home/sites/$group/certs/cert
ificate\n";
                $PerlConfig .= "SSLCertificateKeyFile 
/home/sites/$group/certs/k
ey\n";
                $PerlConfig .= join('', @ssl_conf);
            } elsif (ssl_cert_check("/home/sites/home/certs/") =~ /^2/ ) {
                $PerlConfig .= "Listen $ip:443\n";
                $PerlConfig .= "<VirtualHost $ip:443>\n";
                $PerlConfig .= "SSLengine on\n";
                $PerlConfig .= "SSLCertificateFile 
/home/sites/home/certs/certif
icate\n";
                $PerlConfig .= "SSLCertificateKeyFile 
/home/sites/home/certs/key\n";
                $PerlConfig .= join('', @ssl_conf);
            } else {
                print STDERR "Site $group has invalid certificate: $ret\n";
            }
        }
    }
}
close HTTPD_CONF;
if ( ssl_cert_check("/home/sites/home/certs/") =~ /^2/ ) {
    $proto = 'https';
} else {
    $proto = 'http';
}
$rewrite_rules =
'RewriteEngine On
RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteCond %{DOCUMENT_ROOT}            !-d
RewriteRule .*                          
proto://servername:81/.cobalt/error/forb
idden.html [L,R]
RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/admin/?$                  
proto://servername:81/.cobalt/sysManage/
index.html [L,R]
RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/siteadmin/?$              
proto://servername:81/.cobalt/siteManage
/%1/index.html [L,R]
RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/personal/?$               
proto://servername:81/.cobalt/personal/i
ndex.html [L,R]
RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/.cobalt/(.+)              proto://servername:81/.cobalt/$1 
[L,R]
RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/cgi-bin/.cobalt/(.+)      
proto://servername:81/cgi-bin/.cobalt/$1
 [L,R]
';
$rewrite_rules =~ s/servername/%1/g;
$rewrite_rules =~ s/proto/$proto/g;
$PerlConfig .= $rewrite_rules;
if ( -f "/etc/DEBUG" ) {
    print STDERR Apache::PerlSections->dump();
}
</Perl>

NameVirtualHost 213.165.128.58
<VirtualHost 213.165.128.58>
ServerAdmin admin
DocumentRoot /home/sites/home/web
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^213.165.128.58(:80)?$
RewriteCond %{HTTP_HOST}                !^ns.acris.co.uk(:80)?$
RewriteRule ^/(.*)                      http://ns.acris.co.uk/$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? /home/sites/home/users/$1/web/$3
</VirtualHost>
AddHandler cgi-script .cgi
<Directory /home/web/sites/*/public>
        Options +All +ExecCGI
</Directory>
<Files *.inc>
        Order deny,allow
        deny from all
        allow from none
</Files>
<virtualhost www.highwaytoriches.com highwaytoriches.com>
servername www.highwaytoriches.com
CustomLog /home/web/sites/morsenorris/logs/access_log acr

errorlog /home/web/sites/morsenorris/logs/error_log
documentroot /home/web/sites/morsenorris/public
</virtualhost>

<virtualhost www.highwaytoriches.com:443>
sslengine on
SSLCertificateKeyFile /home/web/sites/morsenorris/conf/privatekey
SSLCertificateFile /home/web/sites/morsenorris/conf/certificate
servername www.highwaytoriches.com
transferlog /home/web/sites/morsenorris/logs/access_log
errorlog /home/web/sites/morsenorris/logs/error_log
documentroot /home/web/sites/morsenorris/public/secure
</virtualhost>






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org