httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: Using gzip and CustomLog
Date Thu, 22 Jan 2009 09:38:57 GMT
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<plfgoa@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<rainer.jung@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<rainer.jung@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


Mime
View raw message