Linux 日誌管理[logrotate]
👨💻簡介 logrotate 用途:日誌文件管理工具,用於切割日誌,壓縮轉存,刪除舊的日誌文件,並創建新的日誌文件 預設配置文件位置: /etc/logrotate.conf /etc/logrotate.d 運行機制 logrotate是透過cron來運行的,透過/etc/cron.daily/logrotate這腳本,如要查看cron.daily運行方式,可查看/etc/anacrontab # /etc/anacrontab: configuration file for anacron # See anacron(8) and anacrontab(5) for details. SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # the maximal random delay added to the base delay of the jobs RANDOM_DELAY=45 # the jobs will be started during the following hours only START_HOURS_RANGE=3-22 #period in days delay in minutes job-identifier command 1 5 cron.daily nice run-parts /etc/cron.daily 7 25 cron.weekly nice run-parts /etc/cron.weekly @monthly 45 cron....