You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Paras Fadte <pl...@gmail.com> on 2009/01/21 07:09:20 UTC

Using gzip and CustomLog

Hi ,

Does something like following work in Apache/2.0.55 ?

CustomLog "|/bin/gzip  -c
>>/home/mydir/apache/logs/mydomain.com-access_log.gz" combined

In errorlog it says :

piped log program '/bin/gzip  -c
>>/home/mydir/apache/logs/mydomain.com-access_log.gz' failed
unexpectedly
gzip: >>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
file or directory


What could be the issue here ?

Thank you

-Paras

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
OS  used is SUSE LINUX 10.1 (X86-64)

On Wed, Jan 21, 2009 at 4:42 PM, Paras Fadte <pl...@gmail.com> wrote:
> Hi,
>
> Thanks for the response , I will try that . What I would like to know
> is whether one can combine the gzip usage with rotatelogs utility so
> that as the logs are written in gzipped format  they also get rotated
> as per the time/size specified .
>
> Thanks in advance.
>
> -Paras
>
> On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung <ra...@kippdata.de> wrote:
>> On 21.01.2009 07:09, Paras Fadte wrote:
>>>
>>> Hi ,
>>>
>>> Does something like following work in Apache/2.0.55 ?
>>>
>>> CustomLog "|/bin/gzip  -c
>>>>>
>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>>
>>> In errorlog it says :
>>>
>>> piped log program '/bin/gzip  -c
>>>>>
>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>>
>>> unexpectedly
>>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>>> file or directory
>>>
>>>
>>> What could be the issue here ?
>>
>> It does work for me with Apache 2.2.x. Be sure to add whitespace before and
>> after ">>" (although that wasn't necessary for 2.2.x).
>>
>> If it doesn't work for 2.0, you can use the following workaround, that
>> should do it: create gzip.sh (executable shell script) with the content:
>>
>> #!/bin/sh
>> gzip -c >> $1
>>
>> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>>
>> Caution: it's possible to loose log lines when restarting or stopping the
>> web server, because gzip buffers data and it might be implementation
>> dependent, whether gzip flushes them when signaled to stop. My tests show,
>> that there will be some information lost.
>>
>> I think this discussion belongs to the users list. When proceeding the
>> discussion there, also mention which OS you are using.
>>
>> Regards,
>>
>> Rainer
>>
>>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Hi,

Thanks for the response , I will try that . What I would like to know
is whether one can combine the gzip usage with rotatelogs utility so
that as the logs are written in gzipped format  they also get rotated
as per the time/size specified .

Thanks in advance.

-Paras

On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung <ra...@kippdata.de> wrote:
> On 21.01.2009 07:09, Paras Fadte wrote:
>>
>> Hi ,
>>
>> Does something like following work in Apache/2.0.55 ?
>>
>> CustomLog "|/bin/gzip  -c
>>>>
>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>
>> In errorlog it says :
>>
>> piped log program '/bin/gzip  -c
>>>>
>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>
>> unexpectedly
>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>> file or directory
>>
>>
>> What could be the issue here ?
>
> It does work for me with Apache 2.2.x. Be sure to add whitespace before and
> after ">>" (although that wasn't necessary for 2.2.x).
>
> If it doesn't work for 2.0, you can use the following workaround, that
> should do it: create gzip.sh (executable shell script) with the content:
>
> #!/bin/sh
> gzip -c >> $1
>
> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>
> Caution: it's possible to loose log lines when restarting or stopping the
> web server, because gzip buffers data and it might be implementation
> dependent, whether gzip flushes them when signaled to stop. My tests show,
> that there will be some information lost.
>
> I think this discussion belongs to the users list. When proceeding the
> discussion there, also mention which OS you are using.
>
> Regards,
>
> Rainer
>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Did  anybody had a chance to  look at the attached rotatelogs file?

On Tue, Feb 10, 2009 at 2:32 PM, Paras Fadte <pl...@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 <pl...@gmail.com> wrote:
>> Thanks Rainer.
>>
>> On Sun, Feb 8, 2009 at 8:50 PM, Rainer Jung <ra...@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<pl...@gmail.com>  wrote:
>>>>>
>>>>> Thanks Rainer,
>>>>>
>>>>> yeah.. me not a pro at development .
>>>>>
>>>>> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung<ra...@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<ra...@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.
>>>
>>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
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 <pl...@gmail.com> wrote:
> Thanks Rainer.
>
> On Sun, Feb 8, 2009 at 8:50 PM, Rainer Jung <ra...@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<pl...@gmail.com>  wrote:
>>>>
>>>> Thanks Rainer,
>>>>
>>>> yeah.. me not a pro at development .
>>>>
>>>> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung<ra...@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<ra...@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.
>>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Thanks Rainer.

On Sun, Feb 8, 2009 at 8:50 PM, Rainer Jung <ra...@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<pl...@gmail.com>  wrote:
>>>
>>> Thanks Rainer,
>>>
>>> yeah.. me not a pro at development .
>>>
>>> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung<ra...@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<ra...@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.
>

Re: Using gzip and CustomLog

Posted by Rainer Jung <ra...@kippdata.de>.
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<pl...@gmail.com>  wrote:
>> Thanks Rainer,
>>
>> yeah.. me not a pro at development .
>>
>> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung<ra...@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<ra...@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.

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Hi Rainer,

Can you please help me out with this ?

I am using the rotatelogs utility from apache 2.0.55

Thanks.

-Paras

On Wed, Jan 28, 2009 at 11:20 AM, Paras Fadte <pl...@gmail.com> wrote:
> Hi ,
>
> 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 .
>
> Please help and thanks in advance.
>
> -Paras
>
> On Fri, Jan 23, 2009 at 1:41 PM, Paras Fadte <pl...@gmail.com> wrote:
>> Thanks Rainer,
>>
>> yeah.. me not a pro at development .
>>
>> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung <ra...@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<ra...@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.
>>>
>>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Hi,

Anybody who can respond to my query ?

Thanks.

-Paras

On Wed, Jan 28, 2009 at 11:20 AM, Paras Fadte <pl...@gmail.com> wrote:
> Hi ,
>
> 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 .
>
> Please help and thanks in advance.
>
> -Paras
>
> On Fri, Jan 23, 2009 at 1:41 PM, Paras Fadte <pl...@gmail.com> wrote:
>> Thanks Rainer,
>>
>> yeah.. me not a pro at development .
>>
>> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung <ra...@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<ra...@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.
>>>
>>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Hi ,

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 .

Please help and thanks in advance.

-Paras

On Fri, Jan 23, 2009 at 1:41 PM, Paras Fadte <pl...@gmail.com> wrote:
> Thanks Rainer,
>
> yeah.. me not a pro at development .
>
> On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung <ra...@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<ra...@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.
>>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Thanks Rainer,

yeah.. me not a pro at development .

On Fri, Jan 23, 2009 at 1:30 PM, Rainer Jung <ra...@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<ra...@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.
>

Re: Using gzip and CustomLog

Posted by Rainer Jung <ra...@kippdata.de>.
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<ra...@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.

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Can you please tell me in which file ?

On Fri, Jan 23, 2009 at 1:09 PM, Rainer Jung <ra...@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.
>

Re: Using gzip and CustomLog

Posted by Rainer Jung <ra...@kippdata.de>.
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.

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
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?

Thank you.

-Paras


On Thu, Jan 22, 2009 at 3:08 PM, Rainer Jung <ra...@kippdata.de> wrote:
> On 22.01.2009 08:38, Paras Fadte wrote:
>>
>> Can anyone respond to this query of mine?
>
> I don't have a very nice solution.
>
> I expect you need to create something on your own, using the fact, that the
> pipe syntax in httpd let's you pass the log information to any external
> logger you like.
>
> I expect you would need to create a rotate and compress solution yourself.
>
> The problem is: if you first pipe through rotatelogs, then the name of the
> file changes each time it rotates, so an easy compress solution is a bit
> difficult. If you first pipe through compress/gzip, then the data looses
> it's text line structure. In both cases, one would have to solve the
> buffering issue.
>
> Most people compress via cron jobs, and not on the fly. Please try the users
> list to find more ideas. If you don't find a solution, you might file an
> enhancement request in bugzilla.
>
> Regards,
>
> Rainer
>
>> On Wed, Jan 21, 2009 at 8:15 PM, Paras Fadte<pl...@gmail.com>  wrote:
>>>
>>> Thanks for the response.
>>>
>>> Noticed that graceful apache restart tends to flush the buffer to log
>>> when gzip is used . Can you please shed some light on combining/using
>>> gzip and rotatelogs utility together ?
>>>
>>> -Paras
>>>
>>> On Wed, Jan 21, 2009 at 7:46 PM, Rainer Jung<ra...@kippdata.de>
>>>  wrote:
>>>>
>>>> On 21.01.2009 13:01, Paras Fadte wrote:
>>>>>
>>>>> I tried this and It creates "mydomain.com-access_log.gz" but doesn't
>>>>> seem to update it.
>>>>
>>>> That's the buffering of gzip I mentioned.
>>>>
>>>> Run /path/to/httpd/bin/ab -n 50000 -c 10 -k http://myserver:myport/
>>>>
>>>> and you'll see data arriving.
>>>>
>>>> Regards,
>>>>
>>>> Rainer
>>>>
>>>>> On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung<ra...@kippdata.de>
>>>>>  wrote:
>>>>>>
>>>>>> On 21.01.2009 07:09, Paras Fadte wrote:
>>>>>>>
>>>>>>> Hi ,
>>>>>>>
>>>>>>> Does something like following work in Apache/2.0.55 ?
>>>>>>>
>>>>>>> CustomLog "|/bin/gzip  -c
>>>>>>>>>
>>>>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>>>>>>
>>>>>>> In errorlog it says :
>>>>>>>
>>>>>>> piped log program '/bin/gzip  -c
>>>>>>>>>
>>>>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>>>>>>
>>>>>>> unexpectedly
>>>>>>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>>>>>>> file or directory
>>>>>>>
>>>>>>>
>>>>>>> What could be the issue here ?
>>>>>>
>>>>>> It does work for me with Apache 2.2.x. Be sure to add whitespace
>>>>>> before
>>>>>> and
>>>>>> after ">>" (although that wasn't necessary for 2.2.x).
>>>>>>
>>>>>> If it doesn't work for 2.0, you can use the following workaround, that
>>>>>> should do it: create gzip.sh (executable shell script) with the
>>>>>> content:
>>>>>>
>>>>>> #!/bin/sh
>>>>>> gzip -c>>   $1
>>>>>>
>>>>>> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>>>>>>
>>>>>> Caution: it's possible to loose log lines when restarting or stopping
>>>>>> the
>>>>>> web server, because gzip buffers data and it might be implementation
>>>>>> dependent, whether gzip flushes them when signaled to stop. My tests
>>>>>> show,
>>>>>> that there will be some information lost.
>>>>>>
>>>>>> I think this discussion belongs to the users list. When proceeding the
>>>>>> discussion there, also mention which OS you are using.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Rainer
>
>

Re: Using gzip and CustomLog

Posted by Rainer Jung <ra...@kippdata.de>.
On 22.01.2009 08:38, Paras Fadte wrote:
> Can anyone respond to this query of mine?

I don't have a very nice solution.

I expect you need to create something on your own, using the fact, that 
the pipe syntax in httpd let's you pass the log information to any 
external logger you like.

I expect you would need to create a rotate and compress solution yourself.

The problem is: if you first pipe through rotatelogs, then the name of 
the file changes each time it rotates, so an easy compress solution is a 
bit difficult. If you first pipe through compress/gzip, then the data 
looses it's text line structure. In both cases, one would have to solve 
the buffering issue.

Most people compress via cron jobs, and not on the fly. Please try the 
users list to find more ideas. If you don't find a solution, you might 
file an enhancement request in bugzilla.

Regards,

Rainer

> On Wed, Jan 21, 2009 at 8:15 PM, Paras Fadte<pl...@gmail.com>  wrote:
>> Thanks for the response.
>>
>> Noticed that graceful apache restart tends to flush the buffer to log
>> when gzip is used . Can you please shed some light on combining/using
>> gzip and rotatelogs utility together ?
>>
>> -Paras
>>
>> On Wed, Jan 21, 2009 at 7:46 PM, Rainer Jung<ra...@kippdata.de>  wrote:
>>> On 21.01.2009 13:01, Paras Fadte wrote:
>>>> I tried this and It creates "mydomain.com-access_log.gz" but doesn't
>>>> seem to update it.
>>> That's the buffering of gzip I mentioned.
>>>
>>> Run /path/to/httpd/bin/ab -n 50000 -c 10 -k http://myserver:myport/
>>>
>>> and you'll see data arriving.
>>>
>>> Regards,
>>>
>>> Rainer
>>>
>>>> On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung<ra...@kippdata.de>
>>>>   wrote:
>>>>> On 21.01.2009 07:09, Paras Fadte wrote:
>>>>>> Hi ,
>>>>>>
>>>>>> Does something like following work in Apache/2.0.55 ?
>>>>>>
>>>>>> CustomLog "|/bin/gzip  -c
>>>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>>>>> In errorlog it says :
>>>>>>
>>>>>> piped log program '/bin/gzip  -c
>>>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>>>>> unexpectedly
>>>>>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>>>>>> file or directory
>>>>>>
>>>>>>
>>>>>> What could be the issue here ?
>>>>> It does work for me with Apache 2.2.x. Be sure to add whitespace before
>>>>> and
>>>>> after ">>" (although that wasn't necessary for 2.2.x).
>>>>>
>>>>> If it doesn't work for 2.0, you can use the following workaround, that
>>>>> should do it: create gzip.sh (executable shell script) with the content:
>>>>>
>>>>> #!/bin/sh
>>>>> gzip -c>>   $1
>>>>>
>>>>> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>>>>>
>>>>> Caution: it's possible to loose log lines when restarting or stopping the
>>>>> web server, because gzip buffers data and it might be implementation
>>>>> dependent, whether gzip flushes them when signaled to stop. My tests
>>>>> show,
>>>>> that there will be some information lost.
>>>>>
>>>>> I think this discussion belongs to the users list. When proceeding the
>>>>> discussion there, also mention which OS you are using.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Rainer


Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Can anyone respond to this query of mine?

On Wed, Jan 21, 2009 at 8:15 PM, Paras Fadte <pl...@gmail.com> wrote:
> Thanks for the response.
>
> Noticed that graceful apache restart tends to flush the buffer to log
> when gzip is used . Can you please shed some light on combining/using
> gzip and rotatelogs utility together ?
>
> -Paras
>
> On Wed, Jan 21, 2009 at 7:46 PM, Rainer Jung <ra...@kippdata.de> wrote:
>> On 21.01.2009 13:01, Paras Fadte wrote:
>>>
>>> I tried this and It creates "mydomain.com-access_log.gz" but doesn't
>>> seem to update it.
>>
>> That's the buffering of gzip I mentioned.
>>
>> Run /path/to/httpd/bin/ab -n 50000 -c 10 -k http://myserver:myport/
>>
>> and you'll see data arriving.
>>
>> Regards,
>>
>> Rainer
>>
>>> On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung<ra...@kippdata.de>
>>>  wrote:
>>>>
>>>> On 21.01.2009 07:09, Paras Fadte wrote:
>>>>>
>>>>> Hi ,
>>>>>
>>>>> Does something like following work in Apache/2.0.55 ?
>>>>>
>>>>> CustomLog "|/bin/gzip  -c
>>>>>>>
>>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>>>>
>>>>> In errorlog it says :
>>>>>
>>>>> piped log program '/bin/gzip  -c
>>>>>>>
>>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>>>>
>>>>> unexpectedly
>>>>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>>>>> file or directory
>>>>>
>>>>>
>>>>> What could be the issue here ?
>>>>
>>>> It does work for me with Apache 2.2.x. Be sure to add whitespace before
>>>> and
>>>> after ">>" (although that wasn't necessary for 2.2.x).
>>>>
>>>> If it doesn't work for 2.0, you can use the following workaround, that
>>>> should do it: create gzip.sh (executable shell script) with the content:
>>>>
>>>> #!/bin/sh
>>>> gzip -c>>  $1
>>>>
>>>> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>>>>
>>>> Caution: it's possible to loose log lines when restarting or stopping the
>>>> web server, because gzip buffers data and it might be implementation
>>>> dependent, whether gzip flushes them when signaled to stop. My tests
>>>> show,
>>>> that there will be some information lost.
>>>>
>>>> I think this discussion belongs to the users list. When proceeding the
>>>> discussion there, also mention which OS you are using.
>>>>
>>>> Regards,
>>>>
>>>> Rainer
>>
>

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
Thanks for the response.

Noticed that graceful apache restart tends to flush the buffer to log
when gzip is used . Can you please shed some light on combining/using
gzip and rotatelogs utility together ?

-Paras

On Wed, Jan 21, 2009 at 7:46 PM, Rainer Jung <ra...@kippdata.de> wrote:
> On 21.01.2009 13:01, Paras Fadte wrote:
>>
>> I tried this and It creates "mydomain.com-access_log.gz" but doesn't
>> seem to update it.
>
> That's the buffering of gzip I mentioned.
>
> Run /path/to/httpd/bin/ab -n 50000 -c 10 -k http://myserver:myport/
>
> and you'll see data arriving.
>
> Regards,
>
> Rainer
>
>> On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung<ra...@kippdata.de>
>>  wrote:
>>>
>>> On 21.01.2009 07:09, Paras Fadte wrote:
>>>>
>>>> Hi ,
>>>>
>>>> Does something like following work in Apache/2.0.55 ?
>>>>
>>>> CustomLog "|/bin/gzip  -c
>>>>>>
>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>>>
>>>> In errorlog it says :
>>>>
>>>> piped log program '/bin/gzip  -c
>>>>>>
>>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>>>
>>>> unexpectedly
>>>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>>>> file or directory
>>>>
>>>>
>>>> What could be the issue here ?
>>>
>>> It does work for me with Apache 2.2.x. Be sure to add whitespace before
>>> and
>>> after ">>" (although that wasn't necessary for 2.2.x).
>>>
>>> If it doesn't work for 2.0, you can use the following workaround, that
>>> should do it: create gzip.sh (executable shell script) with the content:
>>>
>>> #!/bin/sh
>>> gzip -c>>  $1
>>>
>>> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>>>
>>> Caution: it's possible to loose log lines when restarting or stopping the
>>> web server, because gzip buffers data and it might be implementation
>>> dependent, whether gzip flushes them when signaled to stop. My tests
>>> show,
>>> that there will be some information lost.
>>>
>>> I think this discussion belongs to the users list. When proceeding the
>>> discussion there, also mention which OS you are using.
>>>
>>> Regards,
>>>
>>> Rainer
>

Re: Using gzip and CustomLog

Posted by Rainer Jung <ra...@kippdata.de>.
On 21.01.2009 13:01, Paras Fadte wrote:
> I tried this and It creates "mydomain.com-access_log.gz" but doesn't
> seem to update it.

That's the buffering of gzip I mentioned.

Run /path/to/httpd/bin/ab -n 50000 -c 10 -k http://myserver:myport/

and you'll see data arriving.

Regards,

Rainer

> On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung<ra...@kippdata.de>  wrote:
>> On 21.01.2009 07:09, Paras Fadte wrote:
>>> Hi ,
>>>
>>> Does something like following work in Apache/2.0.55 ?
>>>
>>> CustomLog "|/bin/gzip  -c
>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>> In errorlog it says :
>>>
>>> piped log program '/bin/gzip  -c
>>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>> unexpectedly
>>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>>> file or directory
>>>
>>>
>>> What could be the issue here ?
>> It does work for me with Apache 2.2.x. Be sure to add whitespace before and
>> after ">>" (although that wasn't necessary for 2.2.x).
>>
>> If it doesn't work for 2.0, you can use the following workaround, that
>> should do it: create gzip.sh (executable shell script) with the content:
>>
>> #!/bin/sh
>> gzip -c>>  $1
>>
>> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>>
>> Caution: it's possible to loose log lines when restarting or stopping the
>> web server, because gzip buffers data and it might be implementation
>> dependent, whether gzip flushes them when signaled to stop. My tests show,
>> that there will be some information lost.
>>
>> I think this discussion belongs to the users list. When proceeding the
>> discussion there, also mention which OS you are using.
>>
>> Regards,
>>
>> Rainer

Re: Using gzip and CustomLog

Posted by Paras Fadte <pl...@gmail.com>.
I tried this and It creates "mydomain.com-access_log.gz" but doesn't
seem to update it.

On Wed, Jan 21, 2009 at 4:27 PM, Rainer Jung <ra...@kippdata.de> wrote:
> On 21.01.2009 07:09, Paras Fadte wrote:
>>
>> Hi ,
>>
>> Does something like following work in Apache/2.0.55 ?
>>
>> CustomLog "|/bin/gzip  -c
>>>>
>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>>
>> In errorlog it says :
>>
>> piped log program '/bin/gzip  -c
>>>>
>>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
>>
>> unexpectedly
>> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
>> file or directory
>>
>>
>> What could be the issue here ?
>
> It does work for me with Apache 2.2.x. Be sure to add whitespace before and
> after ">>" (although that wasn't necessary for 2.2.x).
>
> If it doesn't work for 2.0, you can use the following workaround, that
> should do it: create gzip.sh (executable shell script) with the content:
>
> #!/bin/sh
> gzip -c >> $1
>
> and use "|/path/to/gzip.sh mylogfile" in the CustomLog.
>
> Caution: it's possible to loose log lines when restarting or stopping the
> web server, because gzip buffers data and it might be implementation
> dependent, whether gzip flushes them when signaled to stop. My tests show,
> that there will be some information lost.
>
> I think this discussion belongs to the users list. When proceeding the
> discussion there, also mention which OS you are using.
>
> Regards,
>
> Rainer
>
>

Re: Using gzip and CustomLog

Posted by Rainer Jung <ra...@kippdata.de>.
On 21.01.2009 07:09, Paras Fadte wrote:
> Hi ,
>
> Does something like following work in Apache/2.0.55 ?
>
> CustomLog "|/bin/gzip  -c
>>> /home/mydir/apache/logs/mydomain.com-access_log.gz" combined
>
> In errorlog it says :
>
> piped log program '/bin/gzip  -c
>>> /home/mydir/apache/logs/mydomain.com-access_log.gz' failed
> unexpectedly
> gzip:>>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
> file or directory
>
>
> What could be the issue here ?

It does work for me with Apache 2.2.x. Be sure to add whitespace before 
and after ">>" (although that wasn't necessary for 2.2.x).

If it doesn't work for 2.0, you can use the following workaround, that 
should do it: create gzip.sh (executable shell script) with the content:

#!/bin/sh
gzip -c >> $1

and use "|/path/to/gzip.sh mylogfile" in the CustomLog.

Caution: it's possible to loose log lines when restarting or stopping 
the web server, because gzip buffers data and it might be implementation 
dependent, whether gzip flushes them when signaled to stop. My tests 
show, that there will be some information lost.

I think this discussion belongs to the users list. When proceeding the 
discussion there, also mention which OS you are using.

Regards,

Rainer


RE: Using gzip and CustomLog

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
Have you tried

CustomLog "|/bin/sh \"gzip -c >>/home/mydir/apache/logs/mydomain.com-access_log.gz\"" combined

?

Regards

Rüdiger

> -----Original Message-----
> From: Paras Fadte  
> Sent: Mittwoch, 21. Januar 2009 07:09
> To: dev@httpd.apache.org
> Subject: Using gzip and CustomLog
> 
> Hi ,
> 
> Does something like following work in Apache/2.0.55 ?
> 
> CustomLog "|/bin/gzip  -c
> >>/home/mydir/apache/logs/mydomain.com-access_log.gz" combined
> 
> In errorlog it says :
> 
> piped log program '/bin/gzip  -c
> >>/home/mydir/apache/logs/mydomain.com-access_log.gz' failed
> unexpectedly
> gzip: >>/home/mydir/apache/logs/mydomain.com-access_log.gz: No such
> file or directory
> 
> 
> What could be the issue here ?
> 
> Thank you
> 
> -Paras
>