Skip to content

syslog configuration update for log4j2 #10980

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

Open
wants to merge 3 commits into
base: 4.20
Choose a base branch
from

Conversation

DaanHoogland
Copy link
Contributor

@DaanHoogland DaanHoogland commented Jun 6, 2025

Description

This PR updates the syslog configuration log4j 2. The configuration as was includes non-existent elements and seems incomplete.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

On a server the lines as in this PR were changed and rsyslog was configured with the imtcp module. Messages would then appear in /various/log/messages

How did you try to break this feature and the system with this change?

Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 4.00%. Comparing base (10fc1f3) to head (fd85caa).
Report is 7 commits behind head on 4.20.

❗ There is a different number of reports uploaded between BASE (10fc1f3) and HEAD (fd85caa). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (10fc1f3) HEAD (fd85caa)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               4.20   #10980       +/-   ##
=============================================
- Coverage     16.14%    4.00%   -12.15%     
=============================================
  Files          5656      402     -5254     
  Lines        497893    32608   -465285     
  Branches      60374     5789    -54585     
=============================================
- Hits          80391     1305    -79086     
+ Misses       408540    31154   -377386     
+ Partials       8962      149     -8813     
Flag Coverage Δ
uitests 4.00% <ø> (-0.01%) ⬇️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@weizhouapache
Copy link
Member

@DaanHoogland
can you give more details in the description and the title ?

@DaanHoogland
Copy link
Contributor Author

@DaanHoogland can you give more details in the description and the title ?

will do, work in prgress though (untested as of yet)

@DaanHoogland DaanHoogland marked this pull request as draft June 6, 2025 13:16
Copy link

@Copilot 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 PR updates the syslog configuration files for both the server and client by modifying the log4j 2 settings. The key changes include the addition of new attributes (port, protocol, appName) to the Syslog element, and the removal of the existing ThresholdFilter and PatternLayout configurations.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
server/conf/log4j-cloud.xml.in Updated the Syslog element by adding port, protocol, and appName while removing filtering and layout elements
client/conf/log4j-cloud.xml.in Updated the Syslog element similarly with new port, protocol, and appName attributes
Comments suppressed due to low confidence (2)

server/conf/log4j-cloud.xml.in:59

  • The removal of the ThresholdFilter and PatternLayout elements may lead to unfiltered or unformatted logs. Please confirm that this change is intentional and that the new configuration provides the necessary log filtering.
<Syslog name="SYSLOG" host="localhost" port="514" protocol="UDP" appName="ApacheCloudStack" facility="LOCAL6">

client/conf/log4j-cloud.xml.in:53

  • The new syslog configuration has removed the ThresholdFilter and PatternLayout settings, which might affect log filtering and formatting. Verify that the intended logging behavior is preserved under this new configuration.
<Syslog name="SYSLOG" host="localhost" port="514" protocol="UDP" appName="ApacheCloudStack" facility="LOCAL6">

@DaanHoogland DaanHoogland changed the title syslog syslog configuration update for log4j2 Jun 9, 2025
@DaanHoogland DaanHoogland marked this pull request as ready for review June 9, 2025 07:53
@@ -50,9 +50,7 @@ under the License.
<!-- Append warnings+ to the syslog if it is listening on UDP port -->
<!-- ============================== -->

<Syslog name="SYSLOG" host="localhost" facility="LOCAL6">
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="%d{DEFAULT} %-5p [%c{1.}] (%t:%x) (logid:%X{logcontextid}) %m%ex{filters(${filters})}%n"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

@DaanHoogland is there a reason to remove the pattern and threshold?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, these do not work and I cannot find them in the log4j2 documentation. The empty Syslog works, so I am keeping it as simple as possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

According to the documentation, the Syslog appender accepts a Filter and a Layout, same as the other appenders that are defined in this file (see https://logging.apache.org/log4j/2.12.x/manual/appenders.html#SyslogAppender).
In my env I see that the logs are not being appended to syslog, but that is because it is not listening for it. If I configure it to listen on port 514, and add the port="514" protocol="UDP" configuration on the log4j2 xml it starts working.

@paulgosden
Copy link

@blueorangutan package

@blueorangutan
Copy link

@paulgosden a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13690

@DaanHoogland
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13767

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants