From: LostInTheLoop on
jr4412, on 07/06/2010 06:54 PM, wrote:

> have you tried adding 'copytruncate' (as first line) to your '/etc/
> logrotate.d/httpd'?

This did the trick! I also used /etc/rc.d/rc.httpd restart,
as suggested by Helmut Hullen and Robert Komar.

One last doubt. Looking at the output of
$ logrotate -v
it appears that the postrotate script is executed 3 times, after
each log's rotation. wouldn't it be better to execute it only once?
-------------------------------
$ logrotate -v
-------------------------------
rotating pattern: /var/log/httpd/*_log forced from command line (4
rotations)
empty log files are rotated, old logs are removed
considering log /var/log/httpd/access_log
log needs rotating
considering log /var/log/httpd/error_log
log needs rotating
considering log /var/log/httpd/ssl_request_log
log needs rotating
rotating log /var/log/httpd/access_log, log->rotateCount is 4
renaming /var/log/httpd/access_log.4 to /var/log/httpd/access_log.5
(rotatecount 4, logstart 1, i 4),
renaming /var/log/httpd/access_log.3 to /var/log/httpd/access_log.4
(rotatecount 4, logstart 1, i 3),
renaming /var/log/httpd/access_log.2 to /var/log/httpd/access_log.3
(rotatecount 4, logstart 1, i 2),
renaming /var/log/httpd/access_log.1 to /var/log/httpd/access_log.2
(rotatecount 4, logstart 1, i 1),
renaming /var/log/httpd/access_log.0 to /var/log/httpd/access_log.1
(rotatecount 4, logstart 1, i 0),
old log /var/log/httpd/access_log.0 does not exist
copying /var/log/httpd/access_log to /var/log/httpd/access_log.1
truncating /var/log/httpd/access_log
running postrotate script
removing old log /var/log/httpd/access_log.5
rotating log /var/log/httpd/error_log, log->rotateCount is 4
renaming /var/log/httpd/error_log.4 to /var/log/httpd/error_log.5
(rotatecount 4, logstart 1, i 4),
renaming /var/log/httpd/error_log.3 to /var/log/httpd/error_log.4
(rotatecount 4, logstart 1, i 3),
renaming /var/log/httpd/error_log.2 to /var/log/httpd/error_log.3
(rotatecount 4, logstart 1, i 2),
renaming /var/log/httpd/error_log.1 to /var/log/httpd/error_log.2
(rotatecount 4, logstart 1, i 1),
renaming /var/log/httpd/error_log.0 to /var/log/httpd/error_log.1
(rotatecount 4, logstart 1, i 0),
old log /var/log/httpd/error_log.0 does not exist
copying /var/log/httpd/error_log to /var/log/httpd/error_log.1
truncating /var/log/httpd/error_log
running postrotate script
removing old log /var/log/httpd/error_log.5
rotating log /var/log/httpd/ssl_request_log, log->rotateCount is 4
renaming /var/log/httpd/ssl_request_log.4 to
/var/log/httpd/ssl_request_log.5 (rotatecount 4, logstart 1, i 4),
old log /var/log/httpd/ssl_request_log.4 does not exist
renaming /var/log/httpd/ssl_request_log.3 to
/var/log/httpd/ssl_request_log.4 (rotatecount 4, logstart 1, i 3),
old log /var/log/httpd/ssl_request_log.3 does not exist
renaming /var/log/httpd/ssl_request_log.2 to
/var/log/httpd/ssl_request_log.3 (rotatecount 4, logstart 1, i 2),
old log /var/log/httpd/ssl_request_log.2 does not exist
renaming /var/log/httpd/ssl_request_log.1 to
/var/log/httpd/ssl_request_log.2 (rotatecount 4, logstart 1, i 1),
old log /var/log/httpd/ssl_request_log.1 does not exist
renaming /var/log/httpd/ssl_request_log.0 to
/var/log/httpd/ssl_request_log.1 (rotatecount 4, logstart 1, i 0),
old log /var/log/httpd/ssl_request_log.0 does not exist
log /var/log/httpd/ssl_request_log.5 doesn't exist -- won't try to
dispose of it
copying /var/log/httpd/ssl_request_log to
/var/log/httpd/ssl_request_log.1
truncating /var/log/httpd/ssl_request_log
running postrotate script

From: jr4412 on
On 7 July, 12:47, LostInTheLoop <bump...(a)ro.und> wrote:
> This did the trick! I also used /etc/rc.d/rc.httpd restart,
> as suggested by Helmut Hullen and Robert Komar.

excellent.

> One last doubt. Looking at the output of
> $ logrotate -v
> it appears that the postrotate script is executed 3 times, after
> each log's rotation. wouldn't it be better to execute it only once?

not really. think about it, once per log is exactly what you want.

btw, you can use 'logrotate -dv' to see what logrotate would do, ie. a
dry-run.
 | 
Pages: 1
Prev: installpkg messing up perms
Next: compiz/kde