Skip to content

[9.4] (backport #13436) Replace deprecated LoggingWithTypedOutputs#13544

Open
mergify[bot] wants to merge 2 commits into9.4from
mergify/bp/9.4/pr-13436
Open

[9.4] (backport #13436) Replace deprecated LoggingWithTypedOutputs#13544
mergify[bot] wants to merge 2 commits into9.4from
mergify/bp/9.4/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 requested a review from a team as a code owner April 8, 2026 17:40
@mergify mergify bot added the backport label Apr 8, 2026
@mergify mergify bot requested review from blakerouse and swiatekm and removed request for a team April 8, 2026 17:40
@mergify mergify bot added the backport label Apr 8, 2026
@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)

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 8, 2026

💔 Build Failed

Failed CI Steps

History

cc @orestisfl

@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? 🙏

@github-actions
Copy link
Copy Markdown
Contributor

TL;DR

The golangci-lint workflow failed in lint (macos-latest) due to a gosec G115 finding in pkg/core/logger/logger.go (int -> uint32 conversion risk). Update that permissions conversion to avoid an unchecked int cast and re-run lint.

Remediation

  • In pkg/core/logger/logger.go (around line 223), replace the unchecked os.FileMode(permissions) path with a bounds-safe conversion (for example, keep permissions as os.FileMode/uint32 throughout, or validate range before conversion).
  • Run lint locally (mage check:lint or equivalent) and push the fix; this should clear the failing gosec check.
Investigation details

Root Cause

golangci-lint failed on one new security-lint issue raised by gosec rule G115, which flags potentially unsafe integer conversions.

Evidence

##[error]pkg/core/logger/logger.go:223:31: G115: integer overflow conversion int -> uint32 (gosec)
		file.Permissions(os.FileMode(permissions)),
		                            ^
##[error]issues found

Validation

  • Not run locally in this workflow context (analysis is based on GitHub Actions job logs).

Follow-up

  • After updating the conversion, re-run CI for PR #13544 and confirm all three lint matrix jobs pass.

What is this? | From workflow: PR Actions Detective

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

@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Apr 20, 2026

This pull request has not been merged yet. Could you please review and merge it @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.

2 participants