*.info;mail.none;news.none;authpriv.none;cron.none /var/log/messages
#把除邮件、新闻组、授权信息、计划任务等外的所有通知性消息都写入 messages 文件中。
mail,news.=info /var/adm/info
#把邮件、新闻组中仅通知性消息写入 info 文件,其他信息不写入。
mail.*;mail.!=info /var/adm/mail
#把邮件的除通知性消息外都写入 mail 文件中。
mail.=info /dev/tty12
#仅把邮件的通知性消息发送到 tty12 终端设备
*.* @finlandia
#把所有信息都导向到 finlandia 主机(通过/etc/hosts 或 dns 解析其 IP 地址)
|
参数 |
功能描述 |
compress |
通过gzip 压缩转储以后的日志 |
nocompress |
不需要压缩时,用这个参数 |
copytruncate |
用于还在打开中的日志文件,把当前日志备份并截断 |
nocopytruncate |
备份日志文件但是不截断 |
create mode owner group |
转储文件,使用指定的文件模式创建新的日志文件 |
nocreate |
不建立新的日志文件 |
delaycompress |
与compress 一起使用时,转储的日志文件到下一次转储时才压缩 |
nodelaycompress |
覆盖 delaycompress 选项,转储同时压缩。 |
errors address |
专储时的错误信息发送到指定的Email 地址 |
ifempty |
即使是空文件也转储,这个是 logrotate 的缺省选项。 |
notifempty |
如果是空文件的话,不转储 |
mail address |
把转储的日志文件发送到指定的E-mail 地址 |
missingok |
如果日志不存在则忽略该警告信息 |
nomail |
转储时不发送日志文件 |
olddir directory |
转储后的日志文件放入指定的目录,必须和当前日志文件在同一个文件系统 |
noolddir |
转储后的日志文件和当前日志文件放在同一个目录下 |
prerotate/endscript |
在转储以前需要执行的命令可以放入这个对,这两个关键字必须单独成行 |
postrotate/endscript |
在转储以后需要执行的命令可以放入这个对,这两个关键字必须单独成行 |
daily |
指定转储周期为每天 |
weekly |
指定转储周期为每周 |
monthly |
指定转储周期为每月 |
rotate count |
指定日志文件删除之前转储的次数,0 指没有备份,5 指保留5 个备份 |
tabootext [+] list |
不转储指定扩展名的文件,缺省的扩展名是:.rpm-orig .rpmsave size size当日志文件到达指定的大小时才转储,可以指定bytes(缺省)以及K或者M |
dateext |
使用日期作为命名格式 |
dateformat | 配合dateext使用,紧跟在下一行出现,定义文件切割后的文件名,必须配合dateext使用,只支持 %Y %m %d %s 这四个参数 |
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}
# system-specific logs may be also be configured here.
|
/full/path/to/file
{
option(s)
}
|
#Use logrotate to rotate wtmp
/var/log/wtmp
{
monthly
rotate 1
}
|