设置logrotate使用UTC时间

是否有可能强制logrotate使用一个configuration的UTC时间? 我需要将dateext设置为UTC。 我希望这是像设置datevariables一样简单。 我应该只是运行postrotate和MV文件到一个新的文件名,把事后的UTC时间。 我只是在寻找一个最佳实践或最实际的解决scheme。 提前致谢。

我可爱的尝试便宜了一个设置variables。 🙂

/var/log/bricks/*.log { DATE=`date -u +%Y%m%d` missingok notifempty copytruncate daily dateext dateformat .%Y%m%d compress } 

你有没有想过生成两个configuration,并正常运行logrotate一个configuration。

对于UTCconfiguration,通过包装器运行logrotate:

  #! /bin/sh TZ=UTC export TZ PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH logrotate -s /var/lib/gmt-logrotate.status gmt-logrotate.cfg exit $? 

通过分解它们,你可以分离运行每个logrotateconfiguration的时间。