LOGROTATE.CONF(5) (NAME) logrotate.conf - (DESCRIPTION) logrotate.conf . logrotate . ( ) . include . : # logrotate compress /var/log/messages { rotate 5 weekly postrotate /usr/bin/killall -HUP syslogd endscript } "/var/log/httpd/access.log" /var/log/httpd/error.log { rotate 5 mail recipient@example.org size 100k sharedscripts postrotate /usr/bin/killall -HUP httpd endscript } /var/log/news/* { monthly rotate 2 olddir /var/log/news/old missingok sharedscripts postrotate kill -HUP $(cat /var/run/inn.pid) endscript nocompress } ~/log/*.log {} . () # . (=) . strtoul(3) . /var/log/messages . . ( ) /usr/bin/killall -HUP syslogd . /var/log/httpd/access.log /var/log/httpd/error.log . recipient@example.org ( ). sharedscripts postrotate . ( ). ', \ . /var/log/news . . (tilde expansion) . glob ( GNU glob). ( wildcards) . * logrotate . olddir ( *.log) . systemd(1) ProtectSystem=full logrotate.service . /etc /usr logrotate . (CONFIGURATION FILE DIRECTIVES) logrotate : (Rotation) rotate count mail count . count 0 . -1 maxage ( ). 0 . olddir directory directory . directory copy copytruncate renamecopy . . . noolddir . noolddir ( olddir ). su user group / ( root) . user group . / create . logrotate (root) su . (Frequency) hourly . logrotate cron ( logrotate.timer systemd(1)) . logrotate . daily . weekly [weekday] (weekday) . : 0 1 ... 6 7 . 0 . monthly logrotate ( ). yearly . size size size . size k M G . size 100 size 100k size 100M size 100G . () ( ). (File selection) missingok . nomissingok. nomissingok ( ). ignoreduplicates . ifempty notifempty ( ). notifempty ( ifempty ). minage count count . maxage count count . . rotate -1 . mail maillast . minsize size size (daily weekly monthly yearly). . maxsize size size . . tabooext [+] list ( include ). + . .bak .disabled .dpkg-old .rpmnew .rpmsave .swp ~ . taboopat [+] list (glob) . + . . (Files and Folders) create mode owner group, create owner group ( postrotate) . mode ( chmod(2)) owner group . . nocreate . nocreate ( create ). createolddir mode [owner [group]], createolddir [owner [group]] olddir . 0755 . nocreateolddir . nocreateolddir olddir logrotate . copy . . create . nocopy ( copy ). copytruncate () (truncate) . . . create . nocopytruncate ( copytruncate ). renamecopy ".tmp" . postrotate . norenamecopy ( renamecopy ). shred shred -u unlink() . . noshred shred . shredcycles count shred(1) . allowhardlink (hard link) . . noallowhardlink ( ). (Compression) compress gzip(1) . nocompress. nocompress ( compress). compresscmd . gzip(1) . uncompresscmd . gunzip(1) . compressext . ( .gz). compressoptions . gzip(1) "-6" ( ). delaycompress . compress . nodelaycompress ( delaycompress ). (Filenames) extension ext ext . ( mylog.1.foo.gz mylog.foo.1.gz). addextension ext ext . start count . 0 .0 . 1 . dateext YYYYMMDD . dateformat dateyesterday . nodateext ( dateext ). dateformat format_string strftime(3) . %Y %m %d %H %M %S %V %s %z . -%Y%m%d ( -%Y%m%d%H). dateyesterday dateext . datehourago hourly . (Mail) mail address address . nomail . nomail . mailfirst mail . maillast mail ( ). (Additional config files) include file_or_directory . . . ~/ . (group-writable world-writable) . (Scripts) sharedscripts prerotate postrotate . sharedscripts . . nosharedscripts prerotate postrotate ( ). firstaction script endscript script prerotate . lastaction script endscript script postrotate . prerotate script endscript . . postrotate script endscript . . preremove script endscript . (SCRIPTS) ( prerotate) endscript ( ) /bin/sh . (stderr) (stdout) umask logrotate . su . (USER AND GROUP) (UID/GID) . (FILES) /var/lib/logrotate/status . /etc/logrotate.conf . /etc/logrotate.d/ . (SEE ALSO) chmod(2), gunzip(1), gzip(1), mail(1), shred(1), strftime(3), strtoul(3), (AUTHORS) Erik Troan, Preston Brown, Jan Kaluza. logrotate LOGROTATE.CONF(5)