当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
linux系统日志不自动切分的问题
发布时间:2010/8/11 10:36:20 来源:城市学习网 编辑:ziteng
  解决方案
  log切分是由 /etc/cron.daily/logrotate 完成的。他的配置文件是:
  /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
  # 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 — we’ll rotate them here
  /var/log/wtmp {
  monthly
  create 0664 root utmp
  rotate 1
  }
  # system-specific logs may be also be configured here.
  —————————————————–
  这个文件指定了切分周期等参数。具体对每一个log的切分,是由/etc/logrotate.d目录下的脚本完成的。这个目录下包含 apache、mysql、resin等若干服务的log文件。(邮件的/var/log/maillog是使用syslog写入系统的)
  手工运行/etc/cron.daily/logrotate ,看报告什么错误。
  例如报告
  error: httpd:1 duplicate log entry for /var/log/httpd/access_log
  这是由于在/etc/logrotate.d目录下存在重复项目造成的。经检查用户自行安装了httpd的rpm,所以在etc/logrotate.d目录下存在apache和httpd两个目录切分项目,造成了logrotate程序运行失败。
  解决方法:移出/etc/logrotate.d/httpd文件即可。推荐按照一台干净的服务器,检查是否有多余的log切分项目。
广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved