From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1019 Path: news.gmane.org!not-for-mail From: Alex Efros Newsgroups: gmane.comp.sysutils.supervision.general Subject: apache2 logs -> svlogd Date: Mon, 13 Feb 2006 19:38:13 +0200 Organization: asdfGroup Inc., http://powerman.asdfGroup.com/ Message-ID: <20060213173813.GA6585@home.power> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1139852306 14201 80.91.229.2 (13 Feb 2006 17:38:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Feb 2006 17:38:26 +0000 (UTC) Original-X-From: supervision-return-1255-gcsg-supervision=m.gmane.org@list.skarnet.org Mon Feb 13 18:38:23 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1F8heR-0003Pw-NH for gcsg-supervision@gmane.org; Mon, 13 Feb 2006 18:38:15 +0100 Original-Received: (qmail 4681 invoked by uid 76); 13 Feb 2006 17:38:35 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 4675 invoked from network); 13 Feb 2006 17:38:35 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline User-Agent: Mutt/1.5.11 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1019 Archived-At: 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.