Skip to content

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

Description

@palash-gandhi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions