[CentOS] Logrotate errors

Thu Apr 10 17:55:01 UTC 2014
Marios Zindilis <marios at zindilis.com>

Logrotate, by default, runs daily (not hourly) and renames the log files
that it rotates by appending to them the current date. In your case, you
are running it hourly, so it only runs successfully only once a day. The
second time that it will attempt to run in the same day, it will find that
there already exists a rotated file with the appended date for that same
day, and fail.

So, either run it daily, or change the renaming scheme.


On Wed, Apr 9, 2014 at 9:45 AM, C. L. Martinez <carlopmart at gmail.com> wrote:

> Hi all,
>
>  I have a problem with logrotate and I don't know why. In
> /var/log/messages appears these errors:
>
> Apr  8 15:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 16:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 17:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 18:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 19:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 20:01:02 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 21:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 22:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
> Apr  8 23:01:01 plzfnsm02 logrotate: ALERT exited abnormally with [1]
>
> It seems the problem if with this logrotate.conf (executed every hour):
>
> create
> dateext
>
> /srv/www2/logs/viewer.log {
>    size 512k
>    create 0640 www www
>    missingok
>    rotate 7
>    compress
>    delaycompress
>    copytruncate
>    notifempty
> }
>
> Doing a debug:
>
> [root at www02 ~]# logrotate /data/config/etc/logrotate.conf -dv
> reading config file /data/config/etc/logrotate.conf
> reading config info for /nsm/moloch/logs/viewer.log
>
> Handling 1 logs
>
> rotating pattern: /srv/www2/logs/viewer.log  524288 bytes (7 rotations)
> empty log files are not rotated, old logs are removed
> considering log /srv/www2/logs/viewer.log
>   log needs rotating
> rotating log /srv/www2/logs/viewer.log, log->rotateCount is 7
> dateext suffix '-20140409'
> glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
> glob finding logs to compress failed
> destination /srv/www2/logs/viewer.log-20140409 already exists, skipping
> rotation
>
>  According to this kb from redhat's website:
>
> https://access.redhat.com/site/solutions/39006
>
>  problem could be selinux. But SElinux is disabled:
>
> [root at www02 ~]# sestatus
> SELinux status:                 disabled
> [root at www02 ~]#
>
>  Any idea?? Could be a bug??
>
>  Host is a CentOS 6.5 x86_64 fully patched.
>
> Thanks.
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



-- 
Marios Zindilis