Skip to content

fix(syslog): open syslog channel on write #53738

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

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

leftybournes
Copy link
Contributor

Summary

This fixes a bug where only one tag gets used when multiple tags have been configured (e.g. different tags for 'syslog_tag' and 'syslog_tag_audit')

Checklist

@leftybournes leftybournes requested a review from a team as a code owner July 1, 2025 06:53
@leftybournes leftybournes requested review from ArtificialOwl, nfebe and sorbaugh and removed request for a team July 1, 2025 06:53
Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with syslog, but I don't understand how this change affects the tag. All it does is calling openlog() later and on every write, but the tag is only set once and never changed.

@leftybournes
Copy link
Contributor Author

It's for when apps need their own loggers and are configured to use syslog with a custom tag in addition to core's logger. The admin_audit app instantiates its own Syslog when configured to use it.

@provokateurin
Copy link
Member

Ok but when it creates the instance it can pass the tag already and openlog will be called with it, no?

@leftybournes
Copy link
Contributor Author

Yes, but that's what has been causing the bug in the linked issue. What currently happens is core calls openlog() with its own tag on create and then admin_audit calls it with a different tag on create. All logs get tagged with the value set by admin_audit because it's the last to call openlog(). It's not possible to have two or more simultaneous channels open which is why it's done on write.

@provokateurin
Copy link
Member

Ahhh that totally makes sense. Please include such information in the PR description, so the reason why it was broken and how this fixes it is clear from the start.

@leftybournes
Copy link
Contributor Author

Please include such information in the PR description, so the reason why it was broken and how this fixes it is clear from the start.

My bad 😅

I'll make sure to do that next time.

@leftybournes
Copy link
Contributor Author

/backport to stable31

@leftybournes
Copy link
Contributor Author

/backport to stable30

This fixes a bug where only one tag gets used when multiple tags have
been configured (e.g. different tags for 'syslog_tag' and 'syslog_tag_audit')

Signed-off-by: Kent Delante <kent.delante@proton.me>
@leftybournes leftybournes force-pushed the leftybournes/fix/syslog branch from 01edfbf to eb58d2b Compare July 2, 2025 01:15
@leftybournes leftybournes merged commit 5d14f87 into master Jul 2, 2025
204 of 206 checks passed
@leftybournes leftybournes deleted the leftybournes/fix/syslog branch July 2, 2025 01:45
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.

[Bug]: Not possible to use syslog for both normal logs and audit logs with different tags
3 participants