但是,标准logrotate要求我们指定特定的周期轮数.是否有类似的东西让我们说“每天轮换,并保留尽可能多的历史,直到只有5%的空间免费”?
该平台是Redhat Linux.
解决方法 您可以使用firstaction或lastaction指令来调用测试磁盘可用空间的shell脚本,然后对最旧的文件执行删除 *** 作.firstaction/endscript The lines between firstaction and endscript (both of which must appear on lines by themselves) are executed (using /bin/sh) once before all log files that match the wildcarded pattern are rotated,before prerotate script is run and only if at least one log will actually be rotated. These directives may only appear insIDe a log file deFinition. Whole pattern is passed to the script as first argument. If the script exits with error,no further processing is done. See also lastac- tion.
更新:
这是关于您可以运行的脚本类型的Stackoverflow帖子:
https://stackoverflow.com/questions/7523059/remove-oldest-file-in-repository
总结以上是内存溢出为你收集整理的Linux上的自由空间驱动的日志轮换?全部内容,希望文章能够帮你解决Linux上的自由空间驱动的日志轮换?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)