Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLPX-93370 Logrotate blackbox tests fail because /var/log/fluent/fluentd.log does not exist #791

Conversation

palash-gandhi
Copy link
Contributor

@palash-gandhi palash-gandhi commented Feb 13, 2025

Problem

Logrotate Blackbox tests failed with:

Error executing command "sudo logrotate /etc/logrotate.conf". Code: 1. Error: error: stat of /var/log/fluent/fluentd.log failed: No such file or directory.

I found that on both, develop and os-upgrade that log file is not created. However, with the new version of fluent-package, a logrotate configuration ships as part of the package:

delphix@dlpx-palashgandhi-os-upgrade-qar-162282-766f97e2:~$ dpkg -S /etc/logrotate.d/fluentd
fluent-package: /etc/logrotate.d/fluentd

delphix@dlpx-palashgandhi-os-upgrade-qar-162282-766f97e2:~$ 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
}

While I do think this is also an upstream bug (& filed fluent/fluent-package-builder#796), I feel our usage of fluentd might be to blame equally.

Solution

Add a missingok directive in the logrotate configuration for fluentd.

Testing Done

https://ops-jenkins.eng-tools-prd.aws.delphixcloud.com/job/appliance-build/job/os-upgrade/job/pre-push/188/

delphix@pg-fluentd:~$ cat /etc/logrotate.d/fluentd
/var/log/fluent/fluentd.log {
  daily
  missingok
  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
}

delphix@pg-fluentd:~$ sudo logrotate /etc/logrotate.conf
delphix@pg-fluentd:~$ echo $?
0

@palash-gandhi palash-gandhi force-pushed the dlpx/pr/palash-gandhi/edd0105e-0704-45f5-9dd0-93311a6a2783 branch from e832678 to e917348 Compare February 13, 2025 01:28
@palash-gandhi palash-gandhi marked this pull request as ready for review February 13, 2025 06:27
@palash-gandhi
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants