GZICP.com   
 
    返回首页
    联系我们
 
 
     

管理日志文件工具logrotate简介

www.gzicp.com   2005年3月16日 23:20:01
 

  如果服务器有大量的用户的话,这些日志文件的大小会很快地增加,在服务器硬盘不是非常充足的情况下,必须采取措施防止日志文件将硬盘撑爆。现代的Linux版本都有一个小程序,名为logrotate,用来帮助用户管理日志文件,它以自己的守护进程工作。logrotate周期性地旋转日志文件,可以周期性地把每个日志文件重命名成一个备份名字,然后让它的守护进程开始使用一个日志文件的新的拷贝。这就是为什么在/var/log/下看到许多诸如maillog、maillog.1、maillog.2、boot.log.1、boot.log.2之类的文件名。它由一个配置文件驱动,该文件是/etc/logroatate.conf,下面是它的一个范例:

# see "man logrotate" for details
# rotate log files weekly
weekly
#以7天为一个周期

# keep 4 weeks worth of backlogs
rotate 4
#每隔4周备份日志文件

# send errors to root
errors root
#发生错误向root报告

# 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 lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

# system-specific logs may be configured here

 刘志勇 郭聪辉

相关文章
·什么是syslogd(2005年03月16日)
·Apche日志系列(5):高级技术(2004年07月03日)
·Apche日志系列(4):日志分析(2004年07月03日)
·Apche日志系列(3):定制日志(2004年07月03日)
·Apche日志系列(2):错误日志(2004年07月03日)
·Apche日志系列(1):访问日志(2004年07月03日)
最新文章
·使用虚拟内存文件系统和绑定安装  (2005年03月18日)
·使用ReiserFS和Linux 2.4  (2005年03月18日)
·日志和ReiserFS  (2005年03月18日)
·管理日志文件工具logrotate简介  (2005年03月16日)
·什么是syslogd  (2005年03月16日)
·使用负载均衡技术建设高负载的网络站点  (2004年09月19日)





 
 
Copyright © 1999-2005 GZICP.com All Rights Reserved