Skip to content

Fix agent becoming unhealthy when log level is changed to warning#12519

Merged
cmacknz merged 7 commits intoelastic:mainfrom
cmacknz:cmacknz/fix-otel-warn-log-level
Feb 2, 2026
Merged

Fix agent becoming unhealthy when log level is changed to warning#12519
cmacknz merged 7 commits intoelastic:mainfrom
cmacknz:cmacknz/fix-otel-warn-log-level

Conversation

@cmacknz
Copy link
Member

@cmacknz cmacknz commented Jan 30, 2026

Fixes agent becoming unhealthy when using the warning log level, which happens only for this level as it's the only one where a case insensitive conversion from a collector log level fails ("WARN" vs "warning").

Refactors the OTel manager to represent the log level as a logp level instead of an untyped string and allow unit testing the log level resolution logic after a configuration change.

@mergify
Copy link
Contributor

mergify bot commented Jan 30, 2026

This pull request does not have a backport label. Could you fix it @cmacknz? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.
@cmacknz cmacknz force-pushed the cmacknz/fix-otel-warn-log-level branch from 238b906 to 17e4d6e Compare February 2, 2026 15:10
@cmacknz cmacknz added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-9.3 Automated backport to the 9.3 branch labels Feb 2, 2026
@cmacknz cmacknz marked this pull request as ready for review February 2, 2026 15:27
@cmacknz cmacknz requested a review from a team as a code owner February 2, 2026 15:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

LGTM. I agree the naming is unfortunate. Imo it should go like so:

  • logLevel -> collectorLogLevel
  • baseLogger -> collectorLogger
  • logger -> managerLogger
@cmacknz
Copy link
Member Author

cmacknz commented Feb 2, 2026

Thanks! I should be able to do a follow up improving the names.

@cmacknz cmacknz merged commit 94a26a4 into elastic:main Feb 2, 2026
26 checks passed
mergify bot pushed a commit that referenced this pull request Feb 2, 2026
…2519)

* Handle a nil monitoring config getter

* Use correct logger during translation

* Add test case to reproduce the problem

* Switch from string to logp.Level in subprocess execution.

* Add test for log level translation.

* Fixes after self-review.

* Add changelog.

(cherry picked from commit 94a26a4)
cmacknz added a commit that referenced this pull request Feb 2, 2026
…2519) (#12557)

* Handle a nil monitoring config getter

* Use correct logger during translation

* Add test case to reproduce the problem

* Switch from string to logp.Level in subprocess execution.

* Add test for log level translation.

* Fixes after self-review.

* Add changelog.

(cherry picked from commit 94a26a4)

Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
@cmacknz
Copy link
Member Author

cmacknz commented Feb 2, 2026

#12559 to rename the loggers.

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

Labels

backport-9.3 Automated backport to the 9.3 branch Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

3 participants