天天看點

logstate配置檔案

logrotate指令用于對系統日志進行輪轉、壓縮和删除,也可以将日志發送到指定郵箱。

每個記錄檔案都可被設定成每日,每周或每月處理,也能在檔案太大時立即處理。

# 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

    create 0600 root utmp

/usr/local/tomcat/logs/catalina.out{

copytruncate

daily

rotate 5

missingok

size 50M

/usr/local/tomcat/logs/contacts-service.log{

copytruncate 用于還在打開中的日志檔案,把目前日志備份并截斷

daily 指定轉儲周期為每天

dateext  歸檔老版本的日志檔案添加一個日期

missingok  如果日志檔案丢失繼續下一個不釋出一個錯誤消息

size 50M 當日志檔案到達指定的大小時才轉儲

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

本文轉自chenzudao51CTO部落格,原文連結:http://blog.51cto.com/victor2016/1919870 ,如需轉載請自行聯系原作者

繼續閱讀