2
cat /etc/logrotate.d/syslog

...
/var/log/messages {
    daily
    compress
    dateext
    dateformat "-%Y%m%d-%s"
    maxage 90
    rotate 90
    missingok
    notifempty
    size +4096k
    create 644 root root
    sharedscripts
    postrotate
    /etc/init.d/syslog reload
    endscript
}
...


SERVER:/var/log # /usr/sbin/logrotate /etc/logrotate.conf >/dev/null
error: syslog:21 unknown option 'dateformat' -- ignoring line
error: syslog:21 unexpected text
error: destination /var/log/messages-20141002.gz already exists, skipping rotation
SERVER:/var/log # 

Q: on a SLES10, how can I set the dateformat option in the logrotate config file to have not only the YYYYMMDD format in the rotated filesnames, rather it should also have additional thing, hour or minute or any unique.

The problem is that it needs to be rotated more than one time per day, so using the day isn't OK, since "already exists"..

updated:

SERVER:~ # rpm -qa|grep -i ^logrotate
logrotate-3.7.3-13.17.1
SERVER:~ # 

1 Answer 1

4

The dateformat option was introduced in version 3.7.7, so you'll need to upgrade. I do know that 3.7.7 is available in the repo for SLES 11, but I don't know about SLES 10.

(Even apart from this, I'd definitely recommend that you upgrade the server to a more recent version of SLES too, as soon as possible - while it's not quite EOL yet, there won't be any more service packs and it is getting close to the end of its life cycle...)

1
  • How can I get the export file name in postrotate script?
    – Amintabar
    Commented Feb 13, 2019 at 7:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .