linux限制syslog大小,c – 如何限制syslog管理的日志文件的总大小?

Linux实用程序logrotate定期重命名和重用系统错误日志文件,以便它们不占用过多的磁盘空间. Linux系统将有关此内容的所有相关信息存储到文件/etc/logrotate.conf中

有许多属性可以帮助我们管理日志大小.在做任何事情之前,请阅读手册(“man logrotate”).在我的机器上,此文件如下所示:

# see "man logrotate" for details

# rotate log files weekly

weekly

# keep 4 weeks worth of backlogs

rotate 4

# create new (empty) log files after rotating old ones

create

# uncomment this if you want your log files compressed

#compress

# packages drop log rotation information into this directory

include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here

/var/log/wtmp {

missingok

monthly

create 0664 root utmp

rotate 1

}

/var/log/btmp {

missingok

monthly

create 0660 root utmp

rotate 1

}

# system-specific logs may be configured here

我们可以看到日志文件将每周轮换一次.这可能会更改为每日.我的机器上没有启用压缩.如果要使日志文件较小,可以启用此功能.

有一个很好的article,你可能想要参考完全理解这个主题.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值