From 473e06dd951d7783462139e0b0a77c38519aa662 Mon Sep 17 00:00:00 2001 From: cyberwang Date: Thu, 18 Jun 2020 13:42:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=AE=8C=E5=96=84logrotate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- command/logrotate.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/command/logrotate.md b/command/logrotate.md index e80eed65d8..49b0c2cc8d 100644 --- a/command/logrotate.md +++ b/command/logrotate.md @@ -78,6 +78,21 @@ dateext 使用当期日期作为命名格式 dateformat .%s 配合dateext使用,紧跟在下一行出现,定义文件切割后的文件名,必须配合dateext使用,只支持 %Y %m %d %s 这四个参数 size(或minsize) log-size 当日志文件到达指定的大小时才转储 ``` +### 注意事项 +在`/etc/logrotate.d`目录下创建任意后缀名的文件 +```shell +/tmp/log/log* +{ + copytruncate + daily + rotate 30 + missingok + ifempty + compress + noolddir +} +``` +这种情况下,会将轮转过的log再重新轮转,因为轮转过后的文件名也是已log开头的