Red Hat DIRECTORY SERVER 2.0 - GATEWAY Manuale Utente Pagina 59

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 96
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 58
Chapter 7. Logging
There is no record of whether chalk.dept.cam.ac.uk or cheese.dept.cam.ac.uk was
queried.
The hostnames are addresses, not names
The simplest way to address the issue of which website was queried is to move the
CustomLog lines into the virtual host sections and to have two different log files.
This gives them the flexibility to log different things too.
If we really wanted a single log file with the virtual host information we could use
the %v escape code to record it.
<VirtualHost *>
ServerName cheese.dept.cam.ac.uk
DocumentRoot /var/www/CHEESE
CustomLog logs/cheese.log "%t %U %h %s"
</VirtualHost>
Figure 7-8. Setting a log file for cheese.dept.cam.ac.uk
To enable the use of hostnames rather than addresses, we must instruct the web
server to do DNS lookups for the IP addresses on each incoming query. We will do
this with the HostnameLookups command. This command is a core Apache com-
mand and not part of the logging module. It is also required if you plan to do any
access controls based on host names as we will be in the Section called Access control
by client IP address in Chapter 10. We will set this on globally. If either website wanted
to record IP addresses rather than hostnames then it can do so by using %s rather
than %h.
HostnameLookups On
Figure 7-9. Turning on hostname lookups
[26/Mar/2003:14:09:54 +0000] / noether.csi.cam.ac.uk 200
[26/Mar/2003:14:09:54 +0000] /icons/dir.gif noether.csi.cam.ac.uk 304
[26/Mar/2003:14:09:55 +0000] /icons/layout.gif noether.csi.cam.ac.uk 304
[26/Mar/2003:14:09:57 +0000] /alpha.html noether.csi.cam.ac.uk 200
[26/Mar/2003:14:10:00 +0000] /beta.html noether.csi.cam.ac.uk 200
Figure 7-10. The cheese.dept.cam.ac.uk log file
Common Log Format
A standard format for access log files is used by many utilities and replied on by the
web analysis programs. It is called “The Common Log Format” (CLF) and is shown
below.
CustomLog logs/chalk_log "%h %l %u %t \"%r\" %>s %b"
Figure 7-11. httpd.conf: Specifying the Common Log Format for
chalk.dept.cam.ac.uk
noether.csi.cam.ac.uk - - [26/Mar/2003:14:25:49 +0000]
"GET /index.html HTTP/1.1" 304 0
noether.csi.cam.ac.uk - - [26/Mar/2003:14:26:00 +0000]
"GET /nonesuch.html HTTP/1.1" 404 211
Figure 7-12. The Common Log Format for chalk.dept.cam.ac.uk
55
Vedere la pagina 58
1 2 ... 54 55 56 57 58 59 60 61 62 63 64 ... 95 96

Commenti su questo manuale

Nessun commento