You are herelogrotate fails to rotate logs on RHEL4

logrotate fails to rotate logs on RHEL4


By thomas - Posted on 18 July 2006

We have a few RHEL4 servers, logs fail to rotate on the production machines, but not unmodified machines. We discovered that this is a known bug with using noexec on /tmp https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=156594 If you change your /tmp mount to noexec, logrotate cannot work because it tries to execute a script in /tmp to do the rotation. The hack to get it working is to add a TMPDIR in the cron job that runs logrotate (and create a directory that it can execute a script in, mkdir /root/tmp; chmod 1777 /root/tmp) #!/bin/sh export TMPDIR=/root/tmp /usr/sbin/logrotate /etc/logrotate.conf EXITVALUE=$? if [ $EXITVALUE != 0 ]; then /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" fi exit 0
Tags

Excellent article companion.

Logrotate is tremendously useful to be able to support of optimized form our files logs during a long period of time, since beside rotating them we can compress them automatically if we consider it opportune.

Logrotate is an indispensable tool.

A greeting,
Alejandro Arco

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options