Skip to content

Fix syslog config regeneration and reset MDSDSyslogPort on removal#2187

Merged
simathih merged 2 commits into
masterfrom
simathih/syslogfix
Jun 19, 2026
Merged

Fix syslog config regeneration and reset MDSDSyslogPort on removal#2187
simathih merged 2 commits into
masterfrom
simathih/syslogfix

Conversation

@simathih

@simathih simathih commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

ICM Incident

  • ICM: 51000001066122
  • Title: [Pending PG] || # [AzMonCRI] -10-azuremonitoragent-omfwd.conf is not recreated after re-associating the Syslog DCR
  • Symptom: After removing a Syslog DCR association and re-associating the same DCR, 10-azuremonitoragent-omfwd.conf is not recreated — Syslog collection stops while Heartbeat continues working.
  • Root Cause: In generate_localsyslog_configs(), the early return if syslog_port == MDSDSyslogPort fires because MDSDSyslogPort remains cached from the first generation. remove_localsyslog_configs() deletes the conf file but never resets MDSDSyslogPort, so within the same long-lived watcher process, re-association is a no-op.
  • Affected Versions: 1.40.0+ (MDSDSyslogPort was introduced in 1.40.0)
  • Environment: RedHat 8.9, AMA 1.41, North Europe

Changes

  • generate_localsyslog_configs: Do not return early when syslog_port == MDSDSyslogPort if none of the syslog config files exist (/etc/rsyslog.d/10-azuremonitoragent-omfwd.conf, /etc/rsyslog.d/10-azuremonitoragent.conf, /etc/syslog-ng/conf.d/azuremonitoragent-tcp.conf, /etc/syslog-ng/conf.d/azuremonitoragent.conf). This ensures configs are regenerated when missing.
  • remove_localsyslog_configs: Reset MDSDSyslogPort to 0 so subsequent calls to generate_localsyslog_configs will not short-circuit.

Related Work Items

  • ADO Bug: 38499977 (will be closed when PR merges)

- In generate_localsyslog_configs, do not return early when syslog_port
  equals MDSDSyslogPort if none of the syslog config files exist, ensuring
  configs are regenerated when missing.
- In remove_localsyslog_configs, reset MDSDSyslogPort to 0 so the next
  call to generate_localsyslog_configs will not short-circuit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simathih simathih requested a review from a team as a code owner June 18, 2026 22:05
jaytripath
jaytripath previously approved these changes Jun 18, 2026
- Test generate_localsyslog_configs does not return early when port
  matches but no config files exist (covers the regeneration fix)
- Test generate_localsyslog_configs returns early when port matches
  and config files are present
- Test remove_localsyslog_configs resets MDSDSyslogPort to 0
- Test port reset enables subsequent config regeneration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simathih simathih merged commit 8a74ed2 into master Jun 19, 2026
5 checks passed
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.

2 participants