简介
logrotate旨在简化生成大量日志文件的系统的管理。它允许自动轮换、压缩、删除和邮寄日志文件。每个日志文件可以每天、每周、每月或当它变得太大时处理。
安装
以centos7或ubuntu20.04为例,系统默认已经安装好logrotate,未安装的情况下,也可以通过以下命令安装logrotate
# centos
# 安装命令
sudo yum install logrotate
# ubuntu
# 安装命令
sudo apt install logrotate
# 版本确认
logrotate --version
命令
[root@192 ~]# logrotate -?
用法: logrotate [OPTION...] <configfile>
-d, --debug Don't do anything, just test (implies -v)
-f, --force Force file rotation
-m, --mail=command Command to send mail (instead of `/bin/mail')
-s, --state=statefile Path of state file
-v, --verbose Display messages during rotation
-l, --log=STRING Log file
--version Display version information
Help options:
-?, --help Show this help message
--usage Display brief u

&spm=1001.2101.3001.5002&articleId=134041218&d=1&t=3&u=3dc8faa1bbe846c186ef87cff89c363c)
1万+

被折叠的 条评论
为什么被折叠?



