-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor syslog-ng configuration and enhance SyslogSender class #871
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
Conversation
Misha-Shvets
commented
Dec 19, 2025
- Update syslog-ng.conf to use syslog-protocol flags for TCP and UDP sources.
- Change local log destination to audit log with a new template.
- Introduce a new destination for parsing errors.
- Refactor SyslogSender to utilize RFC 5424 serialization for sending audit events.
- Remove deprecated methods and streamline message generation process.
* Update syslog-ng.conf to use syslog-protocol flags for TCP and UDP sources. * Change local log destination to audit log with a new template. * Introduce a new destination for parsing errors. * Refactor SyslogSender to utilize RFC 5424 serialization for sending audit events. * Remove deprecated methods and streamline message generation process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the syslog audit logging system to improve RFC 5424 compliance and maintainability by extracting serialization logic into a dedicated class and updating the syslog-ng configuration to properly parse RFC 5424 formatted messages.
Key Changes
- Created a new
RFC5424Serializerclass that encapsulates all RFC 5424 message formatting logic - Updated syslog-ng configuration to use
syslog-protocolflags instead ofno-parse, enabling proper RFC 5424 message parsing - Streamlined
SyslogSenderclass by delegating message formatting to the new serializer and adding explicit protocol validation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
syslog-ng.conf |
Updated source flags to syslog-protocol, changed destination from generic messages to audit-specific log with RFC 5424 template, added parse errors destination |
app/ldap_protocol/policies/audit/events/service_senders/syslog.py |
Refactored to use RFC5424Serializer for message formatting, removed inline serialization methods, added explicit protocol validation |
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py |
New file containing RFC 5424 compliant serialization logic with proper field formatting, sanitization, and structured data handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/syslog.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
…comment out error log destination
…ve commented error log destination
milov-dmitriy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
порешай заметки от копилоты плз, я потом еще раз гляну
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/syslog.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
…ng and timestamp formatting * Change severity validation to raise NotImplementedError for out-of-range values. * Update timestamp formatting to use ISO 8601 with milliseconds precision. * Rename serializer attribute in SyslogSender for clarity.
milov-dmitriy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
еще я предлагаю сделать тесты, прям на этот модуль можно или только на этот сериализатор, чтобы наглядно было и можно было досконально не вчитываться
app/ldap_protocol/policies/audit/events/service_senders/syslog.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Show resolved
Hide resolved
…functionality * Rename serializer attribute in SyslogSender for better readability. * Update structured data ID suffix to reflect proper usage of Private Enterprise Number (PEN). * Enhance docstring for _sanitize_param_name method to clarify RFC 5424 constraints. * Introduce unit tests for RFC5424Serializer to ensure correct functionality and validation.
app/ldap_protocol/policies/audit/events/service_senders/rfc5424_serializer.py
Outdated
Show resolved
Hide resolved
app/ldap_protocol/policies/audit/events/service_senders/syslog.py
Outdated
Show resolved
Hide resolved
…functionality * Rename _format_priority method to _format_severity for better alignment with RFC 5424 terminology. * Update serialization logic in RFC5424Serializer to use severity instead of priority. * Modify SyslogSender to raise NotImplementedError for unsupported protocols. * Adjust unit tests to reflect changes in method names and expected values.