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

CA-389496: Avoid conflicts in configuration for rotating xapi logs #5507

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

psafont
Copy link
Member

@psafont psafont commented Mar 11, 2024

The custom logrotation sometimes conflicted with the normal one. Remove the former.

Install the xapi logrotate configuration has been moved to be managed as part of the normal logrotation, with the global settings removed.

Drafting as I'm creating the builds

@psafont psafont requested a review from robhoes March 11, 2024 17:04
@psafont
Copy link
Member Author

psafont commented Mar 11, 2024

@rosslagerwall you might want to review this

@psafont psafont changed the title CA-389496: Avoid conflicts when rotating xapi logs CA-389496: Avoid conflicts in configuration when rotating xapi logs Mar 11, 2024
@psafont psafont changed the title CA-389496: Avoid conflicts in configuration when rotating xapi logs CA-389496: Avoid conflicts in configuration for rotating xapi logs Mar 11, 2024
@psafont
Copy link
Member Author

psafont commented Mar 12, 2024

Manual testing shows that logrotation on size reached happens correctly, and no loss is observed. I'm double-checking the update case

@psafont
Copy link
Member Author

psafont commented Mar 12, 2024

I've tested the following update cases:

  • On an unfixed system, got xensource.log to +101MiB; see how it gets stuck there
  • Ran /opt/xensource/libexec/xapi-logrotate.sh and saw xensource.log renamed to xensource.log.1, and xensource.log starts being written to.
  • Updated to the new version; logrotation happens as expected when reaching 101MB

And

  • On an unfixed system, got xensource.log to +101MiB; see how it gets stuck there
  • Updated to the new version; logrotation doesn't happen. rsyslogd need to reopen the configuration files (e.g. kill -HUP $(pidof rsyslogd))

A robust solution for the second case is needed before taking the fix

@rosslagerwall
Copy link
Contributor

    # Rotate when file exceeds this size, even if we rotated it today already.
    maxsize 100M

This should already be set in /etc/logrotate.conf so it is not necessary to specify it here.

@psafont
Copy link
Member Author

psafont commented Mar 12, 2024

The second scenario will get taken care of in the .spec as a post-install procedure

@psafont psafont marked this pull request as ready for review March 12, 2024 14:12
@psafont
Copy link
Member Author

psafont commented Mar 12, 2024

    # Rotate when file exceeds this size, even if we rotated it today already.
    maxsize 100M

This should already be set in /etc/logrotate.conf so it is not necessary to specify it here.

The kill -HUP also seems suspect as well, but I'm seeing that in many of the logrotate configuration files (with rsyslogd.pid, which doesn't exist)

The custom logrotation setup for xapi sometimes conflicted with the normal one.
Remove the former.

Install the xapi logrotate configuration has been moved to be managed as part
of the normal logrotation, with the global settings removed.

Duplicate settings in the configuration have been removed.

Signed-off-by: Pau Ruiz Safont <[email protected]>
@rosslagerwall
Copy link
Contributor

The kill -HUP also seems suspect as well, but I'm seeing that in many of the logrotate configuration files (with rsyslogd.pid, which doesn't exist)

Why is it suspect? Something has to tell rsyslog to reopen its output file otherwise it will continue writing to the rotated log file.
The only instance of rsyslog.pid that I see is in audit which kill()s both syslog.pid and rsyslog.pid. In that case, the latter is unnecessary but also harmless.

@psafont psafont merged commit 667a9d2 into xapi-project:master Mar 13, 2024
28 checks passed
@psafont psafont deleted the woodchuck branch March 13, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants