Skip to content

bmcctld: stop teeing routine logs to /var/log/syslog - #875

Merged
judyjoseph merged 1 commit into
sonic-net:masterfrom
nexthop-ai:chinmoy.bmcctld.syslog
Aug 14, 2026
Merged

bmcctld: stop teeing routine logs to /var/log/syslog#875
judyjoseph merged 1 commit into
sonic-net:masterfrom
nexthop-ai:chinmoy.bmcctld.syslog

Conversation

@chinmoy-nexthop

@chinmoy-nexthop chinmoy-nexthop commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Why i did it?

Fixes: sonic-net/sonic-buildimage#28982
Fixes: #872

  • bmcctld FileHandler currently has no log rotation mechanism, making it the only unrotated writer to syslog within PMON. The write volume is low, but the log is effectively bounded only by the event rate.
  • EventLogger tees every log call to DEFAULT_LOG_FILE = "/var/log/syslog" using a plain logging.FileHandler, without any maxBytes or backupCount. This path lives in PMON’s writable overlay, so the host’s logrotate cannot manage it, and PMON does not have a cron-based rotation mechanism. As a result, it is the only file in the container without any form of rotation. Since the file is append-only and persists across reboots, it can grow monotonically over the lifetime of the device.

How i did it ?

remove the tee to /var/log/syslog rather than adding a RotatingFileHandler. EventLogger already invokes the base class before touching the file on every logging method, so the messages are already handled through the normal logging path, which would avoid maintaining a separate unrotated file

How to verify?

docker exec pmon ls -la /var/log/syslog

Description

Motivation and Context

How Has This Been Tested?

Additional Information (Optional)

EventLogger opened a plain logging.FileHandler on /var/log/syslog, which
inside the pmon container resolves to the container's private overlay.
Host logrotate cannot see that path and pmon has no cron, so the file grew
without bound and persisted across reboots.

Every EventLogger method already calls the sonic_py_common.logger base
class before touching the file, so these messages reach the host-side
rotated syslog through the normal logging path. The file tee was
redundant. Drop it rather than adding a RotatingFileHandler, which would
mean maintaining a second unrotated file for no additional coverage.

log_file is now optional and defaults to None; syslog-only instances get
an inert NullHandler. _daemon_logger, PolicyReader, GracefulShutdownHandler
and BmcEventHandler switch to syslog only. _event_logger keeps
/host/bmc/event.log, which is host-visible and already covered by
logrotate (size 10M, rotate 5).
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

This PR has backport request label(s) for branch(es): msft-202608, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202608: <test result>) in the Test result section as well in your PR description.

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202608: Azure/sonic-platform-daemons.msft#83

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

Projects

None yet

3 participants