当前位置:网站首页>日志轮转logrotate
日志轮转logrotate
2022-07-26 06:39:00 【Hejing_zhang】
日志轮转logrotate
1.配置文件:
- /etc/logrotate.conf #主配置文件
- /etc/logrotate.d #改目录下文件会被读取到/etc/logrotate.conf,如果该目录下的文件没有定义特殊的参数时,以/etc/logrotate.conf文件中的设置作为默认值
2.流程图如下:

- 第一次执行rotate后,原来的messages变成messages.1,而且会重新制造一个新的messages来存储日志文件
- 第二次执行,messages.1变成messages.2,messages变成messages.1,又新创建一个messages
- 第三次执行,messages.2变成messages.3,messages.1变成messages.2,messages变成messages.1,再次创建新的messages,现在就有四个日志了
- 第四次执行,messages.3变成messages.4,messages.2变成messages.3,messages.1变成messages.2,messages变成messages.1,再次创建新的messages。现在一共有
messages.4、messages.3、messages.2、messages.1、messages,删除messages.4 rotate数值表示的是最后留下的归档的文件,就是xxx.tar.gz文件
3.配置文件参数解释
weekly:rotate周期
rotate:保留的归档数
create:原日志文件被归档,要新创建一个日志文件来存储日志
dateext:以日期结尾
compress:归档时是否压缩
size:假如设定100K,触发的条件是只要日志大小达到这个值就会归档
minsize:假如设定100K,触发条件是大小大于100K且周期到了
maxsize:假如设定100K,触发条件是周期到了或者大小满足了就可以
边栏推荐
- The "darkest hour" has not come yet. Cherish every bullet 2020-03-22
- Database and the future of open source
- Differences and relations between varchar and nvarchar in database
- C language file operation
- Force buckle - 3. Longest substring without repeated characters
- 【无标题】
- C language introduction practice (7): switch case calculation of days in the year (normal year / leap year calculation)
- 『牛客|每日一题』有效括号序列
- 【图像隐藏】基于混合 DWT-HD-SVD 的数字图像水印方法技术附matlab代码
- Map dictionary and constraints of go
猜你喜欢
![[pytorch] fine tuning technology](/img/d3/6d0f60fffd815f520f4b3880bd0ac7.png)
[pytorch] fine tuning technology

A tool for quickly switching local host files -- switchhosts

『HarmonyOS』工程的创建与虚拟机的使用

What is the concept and purpose of white box testing? And what are the main methods?

Force buckle - 3. Longest substring without repeated characters

Map集合继承结构

【无标题】

『牛客|每日一题』点击消除

Design principle of infrared circuit of single chip microcomputer

Which "digital currencies" can survive this winter? 2020-03-30
随机推荐
PG Vacuum 杂谈之 auto vacuum
What is KVM? What is KVM virtual machine?
服装行业如何实现数字化生产模式
Vision Transformer 必读系列之图像分类综述
[pytorch] CNN practice - flower species identification
力扣——3. 无重复字符的最长子串
性能测试包括哪些方面?分类及测试方法有哪些?
Quick sort
SQL optimization scheme
【无标题】
@Constructorproperties annotation understanding and its corresponding usage
Overview of image classification of vision transformer must read series
Do you think you are a reliable test / development programmer? "Back to the pot"? Surface and reality
【无标题】
Use scanner to get multiple data types from the keyboard
[1]数学建模基础入门知识
[day02_0419] C language multiple choice questions
[day03_0420] C language multiple choice questions
CS5801_HDMI转EDP优势替代LT6711A方案
BigDecimal变为负数