当前位置: 首页 > news >正文

麒麟信安系统下修改系统默认记录日志大小

当系统长期连续运行时,如果没有限制系统日志大小,可能会出现硬盘被写满的情况,如果需要限制系统日志大小,可通过下面方法进行限制:
修改/etc/systemd/journald.conf
Storage=volatile
SystemMaxUse=2M
RumtimeMaxUse=2M
将日志大小限制为 2M
文件如下:
[系统未激活][root@node5-63 ~]# cat /etc/systemd/journald.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See journald.conf(5) for details.
[Journal]
Storage=volatile
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
SystemMaxUse=2M
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
RuntimeMaxUse=2M
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
MaxRetentionSec=1day
#MaxFileSec=1month
#ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes

修改完成后重新启动服务
systemctl restart systemd-journald.service

在系统日志中能看到修改日志大小限制成功

[系统未激活][root@node5-63 ~]# journalctl -b -u systemd-journald.service
-- Logs begin at Tue 2019-09-03 17:40:10 CST, end at Tue 2019-09-03 17:41:05 CST. --
9月 03 17:40:10 node0-63 systemd-journald[573]: Journal started
9月 03 17:40:10 node0-63 systemd-journald[573]: Runtime Journal (/run/log/journal/3fb2775f95f245879006a2b6f8c4dad7) is 8.0M, max 1.4G, 1.4G
9月 03 17:40:13 node0-63 systemd-journald[573]: Journal stopped
9月 03 17:40:14 node5-63 systemd-journald[1094]: Journal started
9月 03 17:40:14 node5-63 systemd-journald[1094]: Runtime Journal (/run/log/journal/3fb2775f95f245879006a2b6f8c4dad7) is 8.0M, max 2.0M, 0B
9月 03 17:40:14 node5-63 systemd[1]: systemd-journald.service: Succeeded.
9月 03 17:40:14 node5-63 systemd-journald[1094]: Runtime Journal (/run/log/journal/3fb2775f95f245879006a2b6f8c4dad7) is 8.0M, max 2.0M, 0B
原来是 1.4G ,修改后变成 2M。

相关文章:

  • mongodb源码分析session异步接受asyncSourceMessage()客户端流变Message对象
  • [Java恶补day16] 238.除自身以外数组的乘积
  • [蓝桥杯]全球变暖
  • 常见排序算法时间、空间复杂度总结
  • vue-19(Vuex异步操作和变更)
  • Python训练营打卡Day45
  • Spring Boot统一功能处理深度解析
  • 系统掌握PyTorch:图解张量、Autograd、DataLoader、nn.Module与实战模型
  • 网络安全面试题目(无答案)
  • Next.js中Protected Route(受保护路由)
  • reverse笔记
  • Neo4j 完全指南:从入门到精通
  • 八:操作系统设备管理之缓冲、缓存与假脱机
  • 编程技能:格式化打印05,格式控制符
  • NVM!(可以快速替换你的node版本)
  • 免费wordpress模板下载
  • 神经网络与深度学习 网络优化与正则化
  • 63、.NET 异常处理
  • [QMT量化交易小白入门]-六十一、多因子选股+布林带择时年化收益率21.5%
  • FPGA 的硬件结构
  • 建设银行官网网站首页/站长工具seo源码
  • 静态网站模板 大气/数据分析师培训需要多少钱
  • 深圳网站建设学校/超级搜索引擎
  • 滨江网站开发/什么广告推广最有效果
  • 做网站是用wordpress还是DW/外链查询工具
  • 太原有哪些做网站的公司/免费seo优化工具