logrotate工作但忽略大小

时间:2017-12-19 13:50:53

标签: logrotate

  • CentOS v.7
  • Logrotate v.3.8.6

当文件达到5M时,我将logrotate设置为旋转但忽略它,如果我每天添加它将无论大小都会每天旋转,我尝试使用size,minsize和maxsize所有相同唯一的区别是“size”它不是甚至在输出中引用它,这是我的配置和输出logrotate -vdf /etc/logrotate.d/maillog

(运行以下测试时的实际日志文件大小为45K)

(对于所有测试,conf文件都相同,只更改了size参数)

reading config file /etc/logrotate.d/maillog
Allocating hash table for state file, size 15360 B

Handling 1 logs

rotating pattern: /var/log/maillog  forced from command line (50 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/maillog
  log needs rotating
rotating log /var/log/maillog, log->rotateCount is 50
Converted ' -%Y-%m-%d_%H_%s' -> '-%Y-%m-%d_%H_%s'
dateext suffix '-2017-12-19_13_1513689486'
glob pattern '-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
fscreate context set to unconfined_u:object_r:var_log_t:s0
renaming /var/log/maillog to /var/log/maillog-2017-12-19_13_1513689486
creating new /var/log/maillog mode = 0644 uid = 0 gid = 0
running postrotate script
running script with arg /var/log/maillog: "
    systemctl restart rsyslog
    systemctl restart postfix
"

SIZE:

logrotate -vdf /etc/logrotate.d/maillog

reading config file /etc/logrotate.d/maillog
Allocating hash table for state file, size 15360 B

Handling 1 logs

rotating pattern: /var/log/maillog  forced from command line (50 rotations)
empty log files are not rotated, only log files >= 5242880 bytes are rotated, old logs are removed
considering log /var/log/maillog
  log needs rotating
rotating log /var/log/maillog, log->rotateCount is 50
Converted ' -%Y-%m-%d_%H_%s' -> '-%Y-%m-%d_%H_%s'
dateext suffix '-2017-12-19_13_1513689869'
glob pattern '-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
fscreate context set to unconfined_u:object_r:var_log_t:s0
renaming /var/log/maillog to /var/log/maillog-2017-12-19_13_1513689869
creating new /var/log/maillog mode = 0644 uid = 0 gid = 0
running postrotate script
running script with arg /var/log/maillog: "
    systemctl restart rsyslog
    systemctl restart postfix
"

没有给出“日志需要轮换”的理由。

MINSIZE:

logrotate -vdf /etc/logrotate.d/maillog

reading config file /etc/logrotate.d/maillog
Allocating hash table for state file, size 15360 B

Handling 1 logs

rotating pattern: /var/log/maillog  forced from command line (50 rotations)
empty log files are not rotated, log files >= 5242880 are rotated earlier, old logs are removed
considering log /var/log/maillog
  log needs rotating
rotating log /var/log/maillog, log->rotateCount is 50
Converted ' -%Y-%m-%d_%H_%s' -> '-%Y-%m-%d_%H_%s'
dateext suffix '-2017-12-19_13_1513690859'
glob pattern '-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
fscreate context set to unconfined_u:object_r:var_log_t:s0
renaming /var/log/maillog to /var/log/maillog-2017-12-19_13_1513690859
creating new /var/log/maillog mode = 0644 uid = 0 gid = 0
running postrotate script
running script with arg /var/log/maillog: "
    systemctl restart rsyslog
    systemctl restart postfix
"

此处显示“仅旋转日志文件> =”但没有给出“日志需要旋转”的原因。

MAXSIZE:

if (Request.UrlReferrer != null)

{

//Load page  data as normal you are doing.  

}

else

{

// redirect to login page because user have copied and pasted the URL in new tab 

//  and it do not have it previous page url in **Request.UrlReferrer** property.

}

此处显示“日志文件=>已旋转”,但没有给出“日志需要旋转”的原因。

旋转时为什么忽略文件大小?

0 个答案:

没有答案
相关问题