你好,游客 登录 注册 搜索
背景:
阅读新闻

Rsyslog日志服务器搭建以及Loganalyzer安装使用

[日期:2017-02-06] 来源:Linux社区  作者:keep11 [字体:大 中 小]

3、关于日志轮循相关内容,linux中的日志轮循是使用logrotate

# 查看logrotate相关配置文件

[root@bogon ~]# rpm -ql logrotate

/etc/cron.daily/logrotate

/etc/logrotate.conf

/etc/logrotate.d

/usr/sbin/logrotate

/usr/share/doc/logrotate-3.7.8

/usr/share/doc/logrotate-3.7.8/CHANGES

/usr/share/doc/logrotate-3.7.8/COPYING

/usr/share/man/man5/logrotate.conf.5.gz

/usr/share/man/man8/logrotate.8.gz

/var/lib/logrotate.status

# 编缉logrotate配置文件

vim /etc/logrotate.conf

[root@bogon ~]# cat /etc/logrotate.conf

# 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

}

# 以周为单位轮循,4次:messages1.....messages4 massages1.....massages4......,往前覆盖

/var/log/messages {

    weekly

    rotate 4

    dateext

    compress

    missingok

    create 644 root root

    postrotate

    /usr/bin/killall -HUP rsyslogd  #平滑重启rsyslog或者使用/var/run/syslogd.pid更准确

    endscript

}

# system-specific logs may be also be configured here.

# 以时间为结尾,如下:

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-02/140240.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款