Make log severity configurable and consistent between syslog and systemd#84574
Make log severity configurable and consistent between syslog and systemd#84574andrew-sayers wants to merge 4 commits intoansible:develfrom
Conversation
See also ansible/proposals#214 C# EventLogEntryType values do not map neatly to syslog-style severity levels, so this option is ignored in C#.
lib/ansible/module_utils/basic.py sets self._syslog_facility = 'LOG_USER'. 'INFO' is not a valid facility, so this probably never worked as expected.
|
@s-hertel - done. I think this counts as a scope-less change - if not, please let me know what the scope would be. This shouldn't break ansible tasks per se, but could break related scripts for a user who monitors Ansible by e.g. grabbing systemd logs with a missing |
| @@ -0,0 +1,2 @@ | |||
| breaking_changes: | |||
| - Ansible's systemd logs now contain a PRIORITY field (deault value: 5). Downstream programs that inspect Ansible's systemd logs should be updated if they expect the PRIORITY field to be missing (https://github.com/ansible/ansible/pull/84574). | |||
There was a problem hiding this comment.
It's a bit unobvious, but since you have that : in the middle (with a whitespace), the YAML parser makes it a key-value mapping. Here's one way to fix it:
| - Ansible's systemd logs now contain a PRIORITY field (deault value: 5). Downstream programs that inspect Ansible's systemd logs should be updated if they expect the PRIORITY field to be missing (https://github.com/ansible/ansible/pull/84574). | |
| - >- | |
| Ansible's systemd logs now contain a PRIORITY field (deault value: 5). | |
| Downstream programs that inspect Ansible's systemd logs should be updated if | |
| they expect the PRIORITY field to be missing | |
| (https://github.com/ansible/ansible/pull/84574). |
6f72247 to
e471545
Compare
jborean93
left a comment
There was a problem hiding this comment.
From an implementation perspective I'm fine with the changes made to Ansible.Basic.cs
|
@andrew-sayers Could you please rebase this branch? Thanks, |
SUMMARY
This builds on a discussion in ansible/proposals#214, and replaces #84504.
syslog messages are currently hardcoded to LOG_INFO, systemd messages have no defined priority.
Add a
TARGET_LOG_SEVERITYoption and use it in both logging frameworks.Ansible log messages are sent through systemd on systems that have the python3
sdnotifypackage installed. This could be deliberate, but in my case, I just happen to have some services that depend on Debian'spython3-sdnotifypackage. Setting a priority for these messages makes it easier to filter them.There is already a
syslog_facilityoption, so it seems natural to add a severity option as part of this job.Note: the final commit in this PR changes the value of
syslog_facilityinparameters.py. Ansible tried to evaluate this assyslog.INFO, failed because there's no such symbol, and fell back toLOG_USER. I've changed the value toLOG_USERin this PR because it's a tangentially related and easy to review at the same time, but the first two commits can be accepted separately if that's better.ISSUE TYPE