httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Langhoff <martin.langh...@gmail.com>
Subject [users@httpd] Piped logs gotcha: multiple config stanzas pointing to the same cmd string
Date Fri, 11 Oct 2013 20:06:17 GMT
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


Mime
View raw message