Vorraussetzung: cron

Neue Logdatei zu logrotate hinzufügen

Debian 5.0

/etc/logrotate.d/ingo :

/var/log/ingo.log {
    compress
    size=+10
    postrotate
        /etc/init.d/rsyslog reload > /dev/null
    endscript
}

Ubuntu 12.04

/etc/logrotate.d/ingo :

/var/log/ingo.log {
    compress
    size=+10
    postrotate
      reload rsyslog >/dev/null 2>&1 || true
    endscript
}

SuSE 12.3

/etc/logrotate.d/ingo :

/var/log/ingo.log {
    compress
    size=+10
    nodateext
    postrotate
        service reload syslog
    endscript
}

CentOS 6

/etc/logrotate.d/ingo :

/var/log/ingo.log {
  size=+10
  dateformat %Y%m%d-%s
  sharedscripts
  postrotate
    /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
  endscript
}

testen

echo 12345678901234567890 >> /var/log/ingo.log
logrotate -d /etc/logrotate.conf 2>&1 | less
logrotate /etc/logrotate.conf
grep ingo.log /var/lib/logrotate/status
ls /var/log/ingo.log*