Linux日志系统-02:logrotate简介
生活随笔
收集整理的這篇文章主要介紹了
Linux日志系统-02:logrotate简介
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
目錄
1、logrotate作用
2、logrotate具體功能
3、logrotate的配置文件
-----------------------------------------------------------------------------------
1、logrotate作用
(1)logrotate可以實現日志轉儲,目的是防止日志文件太大。
(2)系統的使用方式,每天執行一次logrotate,這是基于計劃任務文件實現,計劃任務腳本/etc/cron.daily/logrotate如下:
?
2、logrotate具體功能
(1)自動對日志文件進行滾動
(2)壓縮日志文件
(3)刪除舊日志
(4)發送郵件通知
?
3、logrotate的配置文件
(1)主配置文件:/etc/logrotate.conf
# see "man logrotate" for details# rotate log files weeklyweekly# keep 4 weeks worth of backlogsrotate 4# create new (empty) log files after rotating old onescreate# use date as a suffix of the rotated filedateext# uncomment this if you want your log files compressed#compress# RPM packages drop log rotation information into this directoryinclude /etc/logrotate.d# no packages own wtmp and btmp -- we'll rotate them here/var/log/wtmp {monthlycreate 0664 root utmpminsize 1Mrotate 1}og/btmp {missingokmonthlycreate 0600 root utmprotate 1}# system-specific logs may be also be configured here.(2)子配置文件:/etc/logrotate.d目錄中
(3)自己的配置文件:/var/lib/logrotate.status(記錄了logrotate的滾動日志的記錄)
總結
以上是生活随笔為你收集整理的Linux日志系统-02:logrotate简介的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux日志系统-01:什么是rsys
- 下一篇: Linux日志系统-03:logrota