您可以使用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帖子: