Skip to content

Conversation

@Misha-Shvets
Copy link
Collaborator

  • 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.
Copy link
Contributor

Copilot AI left a 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 RFC5424Serializer class that encapsulates all RFC 5424 message formatting logic
  • Updated syslog-ng configuration to use syslog-protocol flags instead of no-parse, enabling proper RFC 5424 message parsing
  • Streamlined SyslogSender class 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.

Copy link
Collaborator

@milov-dmitriy milov-dmitriy left a comment

Choose a reason for hiding this comment

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

порешай заметки от копилоты плз, я потом еще раз гляну

…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.
Copy link
Collaborator

@milov-dmitriy milov-dmitriy left a comment

Choose a reason for hiding this comment

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

еще я предлагаю сделать тесты, прям на этот модуль можно или только на этот сериализатор, чтобы наглядно было и можно было досконально не вчитываться

…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.
…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.
@Naksen Naksen merged commit 7ace4da into dev Dec 23, 2025
4 checks passed
@Naksen Naksen deleted the add_rfc_format_1042 branch December 23, 2025 12:18
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