Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 78409 invoked from network); 8 Feb 2009 15:21:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Feb 2009 15:21:52 -0000 Received: (qmail 64873 invoked by uid 500); 8 Feb 2009 15:21:45 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 64796 invoked by uid 500); 8 Feb 2009 15:21:45 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 64787 invoked by uid 99); 8 Feb 2009 15:21:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Feb 2009 07:21:44 -0800 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.227.30.149] (HELO mailserver.kippdata.de) (195.227.30.149) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Feb 2009 15:21:38 +0000 Received: from [192.168.2.137] ([192.168.2.137]) by mailserver.kippdata.de (8.13.5/8.13.5) with ESMTP id n18FLF27019335 for ; Sun, 8 Feb 2009 16:21:15 +0100 (CET) Message-ID: <498EF82F.4070300@kippdata.de> Date: Sun, 08 Feb 2009 16:20:15 +0100 From: Rainer Jung User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1b3pre) Gecko/20081204 Thunderbird/3.0b1 MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: Using gzip and CustomLog References: <75cf5800901202209u5e2e2c04i266f15f6cf7c5569@mail.gmail.com> <49772E4F.1030404@kippdata.de> <75cf5800901210645o6f6d0fb3yd9c8fa99bca593ec@mail.gmail.com> <75cf5800901212338r5406fb4i7853bec40b8994ab@mail.gmail.com> <49783EB1.1050505@kippdata.de> <75cf5800901222255h655163bdkad3deb33f837974d@mail.gmail.com> <49797415.80309@kippdata.de> <75cf5800901222345u2f86b753x487a5e6cee3bf289@mail.gmail.com> <49797915.10103@kippdata.de> <75cf5800901230011q260eb953w27dfb7d454072b71@mail.gmail.com> <75cf5800901272150t7f7d0fdcuc91f07f9f73d459@mail.gmail.com> In-Reply-To: <75cf5800901272150t7f7d0fdcuc91f07f9f73d459@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 28.01.2009 06:50, Paras Fadte wrote: > I have somewhat modified the rotatlogs utility to support compression > . Although it creates files in compressed format (.gz) and rotates > them properly the issue that i am facing is that when apache is > restarted (graceful or stop/start way ) the last created compressed > file doesn't seem to get closed . Is there a way to rectify this ? > For compression I am using zlib . When httpd is restarted or stopped, then most rotatelogs processes get stopped via a signal. The signal could depend on the platform, but in my case it's SIGTERM. You can "truss" your rotatelogs to verify yourself, whether that's true for your Linux system too. truss will show you the signal the rotatelogs process received before terminating. Then you need to register a signal handler, e.g. apr_signal(SIG_TERM, my_signal_handler); which gets called automatically, whenever the process receives the respective signal. Your signal handler my_signal_handler() could then set an internal flag, indicating that you want to cleanup and exit rotatelogs. You can check this flag before and after the blocking read from the log pipe, and if it is set, close your gzip output cleanly and exit rotatelogs. You can temporarily deactivate or activate all signal handlers for SIG_TERM with apr_signal_unblock(SIG_TERM); and apr_signal_block(SIG_TERM); The ErrorLog for the global server behaves a little different, when restarting Apache it doesn't get a signal but instead it will get an EPIPE when trying to read from the log pipe. Regards, Rainer > On Fri, Jan 23, 2009 at 1:41 PM, Paras Fadte wrote: >> Thanks Rainer, >> >> yeah.. me not a pro at development . >> >> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung wrote: >>> On 23.01.2009 08:45, Paras Fadte wrote: >>>> Can you please tell me in which file ? >>> I assume you are building rotatelogs from within the httpd sources. >>> >>> There is a file support/Makefile, which contains a line >>> >>> $(LINK) $(rotatelogs_LTFLAGS) $(rotatelogs_OBJECTS) $(PROGRAM_LDADD) >>> >>> Simply add "-lz" at the end of the line: >>> >>> $(LINK) $(rotatelogs_LTFLAGS) $(rotatelogs_OBJECTS) $(PROGRAM_LDADD) -lz >>> >>> In case you don't know what a Makefile is and how it basically works, you >>> need to read about how to do C software development. >>> >>> Regards, >>> >>> Rainer >>> >>>> On Fri, Jan 23, 2009 at 1:09 PM, Rainer Jung >>>> wrote: >>>>> On 23.01.2009 07:55, Paras Fadte wrote: >>>>>> Hi, >>>>>> >>>>>> I get following error when I try to use "compress" function of zlib in >>>>>> "rotatelogs.c" . I have included "zlib.h" in rotatelogs.c . >>>>>> >>>>>> /home/paras/httpd-2.0.55/support/rotatelogs.c:294: undefined reference >>>>>> to `compress' >>>>>> collect2: ld returned 1 exit status >>>>>> >>>>>> Is it linking error ? where should I make the changes to eliminate this >>>>>> error? >>>>> Add -lz to the linking flags.