Skip to content

[8.19] (backport #13436) Replace deprecated LoggingWithTypedOutputs - #13542

Merged
orestisfl merged 3 commits into
8.19from
mergify/bp/8.19/pr-13436
Apr 28, 2026
Merged

orestisfl merged 3 commits into
8.19from
mergify/bp/8.19/pr-13436

Conversation

@mergify

@mergify mergify Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

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 requested a review from a team as a code owner April 8, 2026 17:40
@mergify
mergify Bot requested review from blakerouse and samuelvl 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

mergify Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

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

golangci-lint failed in workflow run https://github.com/elastic/elastic-agent/actions/runs/24562508458 due to gosec rule G115 at pkg/core/logger/logger.go:223. Update the permissions variable type to avoid the int -> uint32 conversion warning.

Remediation

  • In pkg/core/logger/logger.go, make permissions an os.FileMode value directly (for example permissions := os.FileMode(0o600) and permissions = 0o660), then pass file.Permissions(permissions).
  • Re-run the PR checks after that change; the other matrix jobs were cancelled only because ubuntu-latest failed first.
Investigation details

Root Cause

The failing step is golangci-lint in job lint (ubuntu-latest). The lint run reports a gosec G115 violation for converting permissions from int into os.FileMode at pkg/core/logger/logger.go:223.

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 (read-only workflow log investigation).

Follow-up

  • The flagged line is unchanged by this backport, but because the file is touched and lint runs with --whole-files, the pre-existing issue is surfaced in this PR.

What is this? | From workflow: PR Actions Detective

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

@mergify

mergify Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor Author

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

@mergify

mergify Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

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

@elasticmachine

Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @orestisfl

@orestisfl
orestisfl merged commit 58e7734 into 8.19 Apr 28, 2026
16 of 19 checks passed
@orestisfl
orestisfl deleted the mergify/bp/8.19/pr-13436 branch April 28, 2026 09:33
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