-
Notifications
You must be signed in to change notification settings - Fork 205
(bugfix) log level does not change when standalone agent is reloaded or when otel runtime is used #11998
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
Conversation
|
This pull request does not have a backport label. Could you fix it @khushijain21? 🙏
|
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
|
@khushijain21 just to confirm my understanding, this is only happening with OTel right? |
I was able to reproduce this bug even on 8.18 and 9.2 in standalone elastic-agent. So, no, it doesn't happen with OTel only. |
|
We should definitively add a changelog entry then |
For context there are (not obviously) three paths for managed mode:
|
cmacknz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I tested this locally and it worked with a Fleet managed agent to change the log level via the policy or via the settings action.
There are a couple of improvements to make, and we need some test coverage for this as well showing that the cases that didn't work before still do.
💚 Build Succeeded
History
|
cmacknz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for sticking with this!
|
@Mergifyio backport 8.19 9.1 9.2 9.3 |
✅ Backports have been createdDetails
|
…or when otel runtime is used (#11998) * Fix log level does not change when standalone agent is reloaded (cherry picked from commit 85b7e99) # Conflicts: # internal/pkg/agent/application/application.go # internal/pkg/agent/application/coordinator/coordinator.go # internal/pkg/agent/application/coordinator/coordinator_test.go # internal/pkg/agent/application/coordinator/coordinator_unit_test.go # internal/pkg/otel/manager/manager.go # internal/pkg/otel/manager/manager_test.go
…or when otel runtime is used (#11998) * Fix log level does not change when standalone agent is reloaded (cherry picked from commit 85b7e99) # Conflicts: # internal/pkg/agent/application/application.go # internal/pkg/agent/application/coordinator/coordinator.go # internal/pkg/agent/application/coordinator/coordinator_test.go # internal/pkg/agent/application/coordinator/coordinator_unit_test.go # internal/pkg/otel/manager/execution.go # internal/pkg/otel/manager/execution_subprocess.go # internal/pkg/otel/manager/manager.go # internal/pkg/otel/manager/manager_test.go # internal/pkg/otel/translate/otelconfig.go # testing/integration/ess/otel_test.go
…or when otel runtime is used (#11998) * Fix log level does not change when standalone agent is reloaded (cherry picked from commit 85b7e99) # Conflicts: # internal/pkg/agent/application/application.go # internal/pkg/agent/application/coordinator/coordinator.go # internal/pkg/agent/application/coordinator/coordinator_test.go # internal/pkg/agent/application/coordinator/coordinator_unit_test.go # internal/pkg/otel/manager/manager.go # internal/pkg/otel/manager/manager_test.go
|
We can technically backport this as it's a bug fix but let's keep it only in 9.3 so we have time to soak test it first. There's no urgency to fix this and it is not a simple change. I've closed the backport PRs to other branches. |
What does this PR do?
When
agent.logging.levelconfig is changed during runtime in standalone elastic-agent, the new log level was not respected. (Note: This works in managed mode. This is the code path followed by managed mode for ref https://github.com/khushijain21/elastic-agent/blob/loglevel/internal/pkg/agent/application/actions/handlers/handler_action_settings.go#L54-L94 )This PR fixes this bug and ensures this works both for process and OTel runtime.
Note: If both
agent.logging.levelandservice::telemetry::logs::levelare set - then the agent log level is applied to process runtime andtelemetry::logsis applied to OTel runtime. If not, all components useagent.logging.levelWhy is it important?
This is important so that we don't have to restart elastic-agent to update its logging level
Checklist
./changelog/fragmentsusing the changelog toolDisruptive User Impact
None
How to test this PR locally
Start standalone elastic-agent with monitoring enabled and change the logging level without restarting. Observe the debug logs.
I tested this PR manually for both process and otel mode. And by switching from INFO-DEBUG-INFO.
Related issues
elastic-otel-collectorsub-process #11959