httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Huynh" <i...@hubspan.com>
Subject RE: [users@httpd] log rotation for apache 2.0.54 on w2k3 server ?
Date Sat, 21 May 2005 15:16:57 GMT
would pipe logging help you then? 

the documentation for pipe logging is just below the rotation section 


Piped Logs
Apache httpd is capable of writing error and access log files through a pipe to another process,
rather than directly to a file. This capability dramatically increases the flexibility of
logging, without adding code to the main server. In order to write logs to a pipe, simply
replace the filename with the pipe character "|", followed by the name of the executable which
should accept log entries on its standard input. Apache will start the piped-log process when
the server starts, and will restart it if it crashes while the server is running. (This last
feature is why we can refer to this technique as "reliable piped logging".)

Piped log processes are spawned by the parent Apache httpd process, and inherit the userid
of that process. This means that piped log programs usually run as root. It is therefore very
important to keep the programs simple and secure.

One important use of piped logs is to allow log rotation without having to restart the server.
The Apache HTTP Server includes a simple program called rotatelogs for this purpose. For example,
to rotate the logs every 24 hours, you can use:

CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common 

Notice that quotes are used to enclose the entire command that will be called for the pipe.
Although these examples are for the access log, the same technique can be used for the error
log.

A similar but much more flexible log rotation program called cronolog is available at an external
site.

As with conditional logging, piped logs are a very powerful tool, but they should not be used
where a simpler solution like off-line post-processing is available.



-----Original Message-----
From: Maxim Vexler [mailto:hq4ever@gmail.com]
Sent: Saturday, May 21, 2005 8:12 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] log rotation for apache 2.0.54 on w2k3 server
?


On 5/21/05, Ian Huynh <ianh@hubspan.com> wrote:
> ---->>>>>> for 2.x documentation, see http://httpd.apache.org/docs-2.0/logs.html#rotation
> ---->>>>>>you may want to also check out http://www.cronolog.org

Thank you for the info but my problem remains.
The 2.x documentation tell me exactly the same thing :
It suggests moving the logs to a new location _while_ Apache is still
writing to them, this is possible on *nix because the kernel sees the
files as inodes (same as creating another hard link).
Then the document suggests doing a "graceful restart", what will
actually happen is that once Apache drops his "ownership" of
access_log (and other files) the system driver (the kernel) will
delete the file.
What happens then is that once Apache receives a new connection it
_recreates_ that access_log (and other files) from scratch.
This whole procedure resulting in a "rotation" because the old file is
in our hands to do with it what ever we please and the new log's size
is 0.

This all true for *nix, it's my luck to fall on a stupid windows
server that doesn't even know how to do the most basic file action :
hard linking.
And to tell you all the truth - IT SUCKS :).

I believe that I'm not the first person in the world to face this
problem so I naturally assumed that a simple solution would be
existing (by the Apache for windows build).

Isn't this the case ?


The only solution I currently aware of is : Stop Apache, move logs,
Start Apache.
I don't think I need to tell you that this is not the preferred way to go.


Thank you for replaying and helping me.


-- 
Cheers, 
Maxim Vexler (hq4ever).

Do u GNU ?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message