Skip to content

[9.3] (backport #13436) Replace deprecated LoggingWithTypedOutputs#13543

Merged
michel-laterman merged 2 commits into9.3from
mergify/bp/9.3/pr-13436
Apr 17, 2026
Merged

[9.3] (backport #13436) Replace deprecated LoggingWithTypedOutputs#13543
michel-laterman merged 2 commits into9.3from
mergify/bp/9.3/pr-13436

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Apr 8, 2026

What does this PR do?

LoggingWithTypedOutputs is deprecated in favor of the Local variant which returns a localized logger instance. Use the returned logger directly via Named() instead of re-reading from global state with logp.NewLogger().

Why is it important?

Clean up of deprecated endpoints. Elastic Agent is the only caller in Elastic: https://github.com/search?q=org%3Aelastic%20LoggingWithTypedOutputs&type=code

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

There shouldn't be any. I've tested locally and both the elastic-agent build from main and with my change seem to produce the same format of logs.

How to test this PR locally

./elastic-agent install --develop --force

and read the *.ndjson logs. Compare with main.

Related issues

…tsLocal (#13436)

LoggingWithTypedOutputs is deprecated in favor of the Local variant which
returns a localized logger instance. Use the returned logger directly
via Named() instead of re-reading from global state with logp.NewLogger().

(cherry picked from commit 5465a5e)
@mergify mergify Bot added the backport label Apr 8, 2026
@mergify mergify Bot added the backport label Apr 8, 2026
@mergify mergify Bot requested a review from a team as a code owner April 8, 2026 17:40
@mergify mergify Bot requested review from michel-laterman and ycombinator and removed request for a team April 8, 2026 17:40
@github-actions github-actions Bot added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Cleanup skip-changelog labels Apr 8, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Apr 13, 2026

This pull request has not been merged yet. Could you please review and merge it @orestisfl? 🙏

@michel-laterman michel-laterman enabled auto-merge (squash) April 16, 2026 23:45
@github-actions
Copy link
Copy Markdown
Contributor

TL;DR

golangci-lint failed on pkg/core/logger/logger.go due to gosec rule G115 (int -> uint32 overflow-risk conversion). Update the file permission variable to use os.FileMode directly and rerun lint.

Remediation

  • In pkg/core/logger/logger.go, replace the inferred int permissions variable with os.FileMode (for example: permissions := os.FileMode(0o600) and permissions = 0o660), then pass it directly to file.Permissions(permissions).
  • Re-run mage check:lint (or the PR golangci-lint workflow) to confirm G115 is resolved.
Investigation details

Root Cause

The permissions literal is currently inferred as int and later converted in a way that triggers gosec G115 for potential integer overflow on conversion to an unsigned 32-bit mode representation.

Evidence

Validation

  • Not run locally in this workflow (read-only Actions triage).

Follow-up

  • macos-latest and windows-latest lint jobs were canceled after the Ubuntu failure; rerunning after this fix should exercise all matrix targets.

What is this? | From workflow: PR Actions Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@michel-laterman michel-laterman merged commit 54bc8db into 9.3 Apr 17, 2026
16 of 19 checks passed
@michel-laterman michel-laterman deleted the mergify/bp/9.3/pr-13436 branch April 17, 2026 01:26
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

cc @orestisfl

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants