supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* apache2 logs -> svlogd
@ 2006-02-13 17:38 Alex Efros
  2006-02-13 18:04 ` Torne Wuff
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Efros @ 2006-02-13 17:38 UTC (permalink / raw)


Hi!

I've just got an idea how to send all apache2 logs to svlogd, and at
first glance this idea looks not so ugly as all other ways I've seen
before to accomplish this task. :-)

Usually apache2 configured in way similar to this: there exists directory
/var/log/apache2/ and it write logs into number of different files (I've
seven: access_log, deflate_log, error_log, rewrite.log, ssl_access_log,
ssl_error_log, ssl_request_log). My idea is replace these files with FIFO,
create svlogd directory for each of these FIFO and create separate
services for each log file with ./run files like this:

---[ /service/apache2_access_log/run ]---
#!/bin/sh
exec >&2
exec svlogd /var/log/apache2/access/   <>/var/log/apache2/access_log
---[ /service/apache2_access_log/run ]---

Also these FIFO must have 0600 permissions, or some users may partially
intercept log messages with simple: cat /var/log/apache2/access_log

This will work without any changes in apache's configuration, but it may
has sense to change log files format, for ex., to replace apache's
datetime with svlogd's.

There should be no problem in splitting these logs 'per virtual host'
using svlogd's ./config into different directories and giving to different
users permissions to read logs only for their virtual hosts.

Because of bash's '<>' svlogd will get in STDIN file (FIFO) opened
both for read&write, so it will not block waiting for other FIFO's side;
also if you restart apache svlogd will not die because it never get EOF.

What you think about this idea? Any flaws?

I don't know what happens if apache will try to write in these FIFO while
log service(s) isn't running. In my quick tests looks like apache just
drop lines which it unable to write in log if I 'sv down' log services.
But if log services not running before apache will start - apache will not
start at all, of course (probably can be solved by same '<>' trick in
apache's ./run file, but I don't think this is really needed).

-- 
			WBR, Alex.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-02-23 13:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-13 17:38 apache2 logs -> svlogd Alex Efros
2006-02-13 18:04 ` Torne Wuff
2006-02-13 18:25   ` Alex Efros
2006-02-14 14:25     ` George Georgalis
2006-02-14 14:47       ` Joshua N Pritikin
2006-02-14 15:58         ` Alex Efros
2006-02-15 15:09           ` George Georgalis
2006-02-23 13:36             ` Dean Hall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).