fix: don't override log level from state for standalone agents#8784
Merged
pkoutsovasilis merged 4 commits intoelastic:mainfrom Jul 7, 2025
Merged
Conversation
Contributor
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Contributor
💚 Build Succeeded
History
|
swiatekm
previously approved these changes
Jul 2, 2025
Contributor
swiatekm
left a comment
There was a problem hiding this comment.
LGTM, though I'd love to have a simple unit test for this function.
Contributor
Author
more than a fair point, lemme check what I can cook for it |
pkoutsovasilis
commented
Jul 2, 2025
e1eb762 to
7ee14ed
Compare
|
swiatekm
approved these changes
Jul 4, 2025
michel-laterman
approved these changes
Jul 4, 2025
Contributor
|
@Mergifyio backport 8.17 8.18 8.19 9.0 9.1 |
Contributor
✅ Backports have been createdDetails
|
mergify bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
* fix: don't override log level from state for standalone agents * doc: add changelog fragment * fix: add unit test for NewAgentInfoWithLog * fix: derive unprivileged from utils.HasRoot (cherry picked from commit e8f759b)
8 tasks
mergify bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
* fix: don't override log level from state for standalone agents * doc: add changelog fragment * fix: add unit test for NewAgentInfoWithLog * fix: derive unprivileged from utils.HasRoot (cherry picked from commit e8f759b)
8 tasks
mergify bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
* fix: don't override log level from state for standalone agents * doc: add changelog fragment * fix: add unit test for NewAgentInfoWithLog * fix: derive unprivileged from utils.HasRoot (cherry picked from commit e8f759b)
8 tasks
mergify bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
* fix: don't override log level from state for standalone agents * doc: add changelog fragment * fix: add unit test for NewAgentInfoWithLog * fix: derive unprivileged from utils.HasRoot (cherry picked from commit e8f759b)
8 tasks
mergify bot
pushed a commit
that referenced
this pull request
Jul 7, 2025
* fix: don't override log level from state for standalone agents * doc: add changelog fragment * fix: add unit test for NewAgentInfoWithLog * fix: derive unprivileged from utils.HasRoot (cherry picked from commit e8f759b)
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




What does this PR do?
This PR fixes a bug where the log level for standalone Elastic Agent installations was incorrectly restored from the persisted state directory (
/var/lib/elastic-agent-standalone/...) instead of being sourced from the current configuration file. This resulted in stale configuration values after updates to the ConfigMap, particularly when the pod was restarted without clearing the state directory.The change ensures that for standalone mode, the
log.levelvalue is always taken from the configuration, not restored from previously persisted agent state. For managed (Fleet) mode, the previous behavior is preserved.Why is it important?
This fix addresses an issue where changes to logging configuration were not taking effect unless the agent's state directory was manually deleted. This led to operational confusion and could cause logs to be emitted at incorrect verbosity levels.
Ensuring that the standalone agent reliably reflects the current configuration helps users maintain observability and avoid side effects like duplicated logs when restarting pods.
Checklist
./changelog/fragmentsusing the changelog toolDisruptive User Impact
This change should not cause disruption. It fixes the logic so that standalone agents correctly reflect updated configuration values after pod restarts, without requiring manual state cleanup. Users relying on previously persisted log levels (instead of ConfigMap changes) may see a difference in behavior, but this aligns with the intended functionality.
How to test this PR locally
Related issues