Skip to content

[8.19] (backport #11998) (bugfix) log level does not change when standalone agent is reloaded or when otel runtime is used#12124

Closed
mergify[bot] wants to merge 1 commit into8.19from
mergify/bp/8.19/pr-11998
Closed

[8.19] (backport #11998) (bugfix) log level does not change when standalone agent is reloaded or when otel runtime is used#12124
mergify[bot] wants to merge 1 commit into8.19from
mergify/bp/8.19/pr-11998

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Jan 7, 2026

What does this PR do?

When agent.logging.level config 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.level and service::telemetry::logs::level are set - then the agent log level is applied to process runtime and telemetry::logs is applied to OTel runtime. If not, all components use agent.logging.level

Why is it important?

This is important so that we don't have to restart elastic-agent to update its logging level

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive 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


This is an automatic backport of pull request #11998 done by [Mergify](https://mergify.com).

…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
@mergify mergify Bot added backport conflicts There is a conflict in the backported pull request labels Jan 7, 2026
@mergify mergify Bot requested a review from a team as a code owner January 7, 2026 05:06
@mergify mergify Bot requested review from michel-laterman and swiatekm and removed request for a team January 7, 2026 05:06
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Jan 7, 2026

Cherry-pick of 85b7e99 has failed:

On branch mergify/bp/8.19/pr-11998
Your branch is up to date with 'origin/8.19'.

You are currently cherry-picking commit 85b7e9932.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   changelog/fragments/1766556100-reload-log-level.yaml
	modified:   internal/pkg/agent/application/periodic.go
	modified:   internal/pkg/agent/cmd/run.go
	modified:   internal/pkg/otel/manager/execution.go
	modified:   internal/pkg/otel/manager/execution_subprocess.go
	modified:   internal/pkg/otel/translate/otelconfig.go
	modified:   testing/integration/ess/otel_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   internal/pkg/agent/application/application.go
	both modified:   internal/pkg/agent/application/coordinator/coordinator.go
	both modified:   internal/pkg/agent/application/coordinator/coordinator_test.go
	both modified:   internal/pkg/agent/application/coordinator/coordinator_unit_test.go
	both modified:   internal/pkg/otel/manager/manager.go
	both modified:   internal/pkg/otel/manager/manager_test.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@elasticmachine
Copy link
Copy Markdown
Contributor

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

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jan 7, 2026

@cmacknz
Copy link
Copy Markdown
Member

cmacknz commented Jan 7, 2026

Let's not backport this to active minors, it's a reasonably complex change and we don't want to release it before we've had a chance to see if any problems come up.

@cmacknz cmacknz closed this Jan 7, 2026
@mergify mergify Bot deleted the mergify/bp/8.19/pr-11998 branch January 7, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts There is a conflict in the backported pull request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants