
Chapter 7. Logging
/bin/kill -HUP ‘cat /var/run/httpd.pid 2>/dev/null‘ 2> /dev/null || true
This messy command sends a SIGHUP signal to the master web server demon.
It is equivalent to /etc/init.d/httpd reload except that it sends the SIGHUP to all
the web server processes.
There are two points which must be made about log rotation and changing its set-
tings. These are to do with the presence of editor backup files and the Data Protection
Act (1998).
Backup files
The command include /etc/logrotate.d will read in every file in that directory. So if
you edit the file httpd and leave behind both httpd and httpd~ then both these files
will be included and your log files will have the log rotation process applied twice.
Now, because of the weekly (or monthly or daily) commands the rotation shouldn’t
actually happen but it is still not certain that the right file will be applied.
Data Protection Act (1998)
The contents of the log files may constitute personal data. If, along
with any information stored within the University, they identify individu-
als then they definitely do. As a result, you must have a privacy policy,
and stick to it. For this reason, the author recommends very strongly
that you remove the notifempty command. If your policy says that per-
sonal data is only kept for 28 days and it is kept for a week longer
because one week’s log files happened to be empty then you are in
breach of your privacy policy.
Log file analysis
Red Hat Linux ships with the webalyzer which is a log file analysis package that
generates a graphical representation of the use of your web server. This can be par-
ticularly useful for convincing heads of department that web servers are actually
used.
This course focuses on the use of the Apache web server so we will not look in depth
at tuning the configuration to vary the format of the output. Instead we will simply
focus on what it does and how to configure it to work with multiple virtual hosts.
The configuration file is /etc/webalizer.conf and is set up to match the Red Hat
default file locations. As we have changed them we have to change this file too.
If you are using the default Red Hat settings then skip this section and look in
http://server/usage/ for the usage statistics.
There are two approaches to changing this configuration for a multiple-site server.
The first is to give each web site a copy of its own configuration file. This lets each
site have full control over the presentation of the usage figures. The second approach
is to have a common configuration file that lacks the per-site information and has
the missing information provided on the command line. This lets each site rely on a
centrally maintained, common presentation format.
In this course we will take the former approach for no better reason than that it’s
slightly easier to teach. This is a course about running Apache, not Webalizer.
Webalizer maintains a directory of pages and images (of usage graphs) to present
the statistics. In the default Red Hat Linux installation this is maintained in
/var/www/html/usage. We will, therefore, create /var/www/CHALK/usage and
/var/www/CHEESE/usage.
59
Commenti su questo manuale