Did  anybody had a chance to  look at the attached rotatelogs file?

On Tue, Feb 10, 2009 at 2:32 PM, Paras Fadte <plf...@gmail.com> wrote:
> Hi Rainer,
>
> I have attached the modified "rotatelogs.c" file (originally taken
> from apache 2.0.55 ) . Can you please have a look at it and let me
> know its shortcomings and chances that it could seg fault ?
>
> Thanks in advance.
>
> -Paras
>
> On Tue, Feb 10, 2009 at 1:37 PM, Paras Fadte <plf...@gmail.com> wrote:
>> Thanks Rainer.
>>
>> On Sun, Feb 8, 2009 at 8:50 PM, Rainer Jung <rainer.j...@kippdata.de> wrote:
>>> 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<plf...@gmail.com>  wrote:
>>>>>
>>>>> Thanks Rainer,
>>>>>
>>>>> yeah.. me not a pro at development .
>>>>>
>>>>> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung<rainer.j...@kippdata.de>
>>>>>  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<rainer.j...@kippdata.de>
>>>>>>>  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.
>>>
>>
>

Reply via email to