fluent-package-builder icon indicating copy to clipboard operation
fluent-package-builder copied to clipboard

fluent-package logrotate configuration causes logrotate failure if fluentd has never run

Open palash-gandhi opened this issue 10 months ago • 6 comments

fluent-package ships a logrotate configuration on a log file that is not guaranteed to exist.

$ cat /etc/logrotate.d/fluentd
/var/log/fluent/fluentd.log {
  daily
  rotate 30
  compress
  delaycompress
  notifempty
  create 640 _fluentd _fluentd
  sharedscripts
  postrotate
    pid=/var/run/fluent/fluentd.pid
    if [ -s "$pid" ]
    then
      kill -USR1 "$(cat $pid)"
    fi
  endscript
}

This can cause invocations of logrotate to fail with:

$ sudo logrotate /etc/logrotate.conf
error: stat of /var/log/fluent/fluentd.log failed: No such file or directory.

While not having fluentd running may not be a common scenario, I do believe this to be a bug in the package.

palash-gandhi avatar Feb 13 '25 01:02 palash-gandhi