日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux日志系统-02:logrotate简介

發布時間:2025/6/15 linux 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux日志系统-02:logrotate简介 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目錄

1、logrotate作用

2、logrotate具體功能

3、logrotate的配置文件

-----------------------------------------------------------------------------------

1、logrotate作用

(1)logrotate可以實現日志轉儲,目的是防止日志文件太大。

(2)系統的使用方式,每天執行一次logrotate,這是基于計劃任務文件實現,計劃任務腳本/etc/cron.daily/logrotate如下:
?

#!/bin/sh/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.confEXITVALUE=$?if [ $EXITVALUE != 0 ]; then/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"fiexit 0

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简介的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。