当前位置: 首页 > 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。
http://www.lqws.cn/news/157339.html

相关文章:

  • [arthas]arthas安装使用
  • vue+element-ui一个页面有多个子组件组成。子组件里面有各种表单,实现点击enter实现跳转到下一个表单元素的功能。
  • 成都芯谷金融中心·文化科技产业园:构建产业新城的实践与探索
  • 基于大数据爬虫+智能AI的网络小说数据可视化系统设计与实现
  • Unity基础-Mathf相关
  • 3ds Max 渲染技术突破:一键解锁照片级真实感!
  • 小程序引入deepseek
  • 每日算法-250605
  • xmind转换为markdown
  • QQ邮箱发送验证码(Springboot)
  • SDC命令详解:使用set_max_fanout命令进行约束
  • MacOS解决局域网“没有到达主机的路由 no route to host“
  • [原创](现代Delphi 12指南):[macOS 64bit App开发]: TTask创建多线程, 更简单, 更快捷.
  • Git 安装全攻略Linux、macOS、Windows 与源码编译
  • redis数据过期策略、淘汰策略
  • 安卓四大组件数据存储Handler
  • React从基础入门到高级实战:React 实战项目 - 项目一:在线待办事项应用
  • Kafka入门-消费者
  • 作为过来人,浅谈一下高考、考研、读博
  • 关于akka官方quickstart示例程序(scala)的记录
  • UDP:简洁高效的报文结构解析与关键注意事项
  • 计算机网络备忘录
  • 网络通信核心概念全解析:从IP地址到TCP/UDP实战
  • ​减少交通拥堵、提高效率、改善交通安全的智慧交通开源了。
  • CodeGeeX 本地模式
  • Golang——9、反射和文件操作
  • 使用SSH tunnel访问内网的MySQL
  • VSCode主题定制:CSS个性化你的编程世界
  • nginx.conf配置详解:从(413 Request Entity Too Large)说起
  • 《前端面试题:CSS的display属性》