Apache LogFormat

Este es un ejemplo de cómo configurar el  formato de los logs de apache ( definidos en la directiva LogFormat ). Proporciona mucha información extra e incluso en servidores con un gran volumen de tráfico sólo añade un poco de overhead, pero para la información que proporciona, merece la pena.

%V The server name according to the UseCanonicalName setting. Useful for virtual hosting servers.
# %h Remote host
# %l Remote logname (from identd, if supplied). This will return a dash unless mod_ident is
# present and IdentityCheck is set On.
# %u Remote user (from auth; may be bogus if return status (%s) is 401)
# %t Time the request was received (standard english format)
# %r First line of request
# %>s status. For requests that got internally redirected, this is the status of the *original*
# request --- %>s  for the last.
# %b Size of response in bytes, excluding HTTP headers. In CLF format, i.e.  a '-' rather than
# a 0 when no bytes are sent.
# %{Referer}i The contents of Foobar: header line(s) in the request sent to the server.
# %{User-Agent}i
# %{Foorbar}C The contents of cookie Foobar in the request sent to the server.
# %P The process ID of the child that serviced the request.
# %D The time taken to serve the request, in microseconds.
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %P %D" vcombinedwithPD

SetEnvIf Request_URI "^/favicon.ico$" dontlog
SetEnvIf User-Agent ".*internal dummy connection.*" dontlog
CustomLog logs/access_log vcombinedwithPD env=!dontlog

He resaltado en negrita una opción que me parece muy interesante, %D, con la que puedes ver el tiempo que tarda Apache en servir cada petición.

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)