You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Martin Langhoff <ma...@gmail.com> on 2013/10/11 22:06:17 UTC

[users@httpd] Piped logs gotcha: multiple config stanzas pointing to the same cmd string

Hi Apache users, devs,

I have recently switched an infra from straight logging to files to
piped logs (using compresslog to compress the logs before they are
written out -- http://repo.or.cz/w/compresslog.git/ ).

Turns out there is a gotcha.

When logging to files, it is harmless to have multiple stanzas
pointing to the same file. Apache might open several file handles to
the same file, but POSIX promises about line-oriented file writes
means that the files won't be a mismash of randomly mixed characters.

When logging to pipes, there is no such protection. So if you have
several stanzas saying "|compresslog /var/log/httpd/access_log",
you'll end up with several compresslog processes racing to open the
same file.

This has been spotted with 2.2.15 on RHEL6.3. Reading SVN sources,
server/log.c has had some minor improvements between 2.2.15 and 2.4.6
on piped logs, but nothing that would prevent this.

On my side, I've taught compresslog to behave sanely in the face of
race conditions.

Perhaps this merits a brief warning in the apache docs?

cheers,



m
-- 
 martin.langhoff@gmail.com
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff

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