Skip to content

Migrate from logrus to slog#39664

Merged
aanm merged 3 commits intomainfrom
pr/move-logrus-to-slog
Jun 4, 2025
Merged

Migrate from logrus to slog#39664
aanm merged 3 commits intomainfrom
pr/move-logrus-to-slog

Conversation

@aanm
Copy link
Copy Markdown
Member

@aanm aanm commented May 21, 2025

Note for reviewers:

I couldn't split this into further commits given the changes in the pkg/logging package required changes everywhere else. 😞

I would appreciate closer review on the introduction of the multihandler (first commit) and on the second commit the changes done in the pkg/logging as well as the pkg/metrics to detect the presence of duplicate attributes in the slog log messages.

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 21, 2025
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 21, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from e4b8f53 to fabf971 Compare May 23, 2025 09:05
@aanm aanm added area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. release-note/misc This PR makes changes that have no direct user impact. feature/slog labels May 23, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 23, 2025
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 23, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from fabf971 to 703a603 Compare May 23, 2025 09:43
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 23, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from 703a603 to a2c65f1 Compare May 23, 2025 10:57
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 23, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from a2c65f1 to df1ed72 Compare May 23, 2025 12:43
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 23, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch 2 times, most recently from e850354 to b52a84b Compare May 23, 2025 14:34
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 23, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from b52a84b to e83b856 Compare May 23, 2025 18:46
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 23, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from e83b856 to b31c111 Compare May 26, 2025 10:14
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 26, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from b31c111 to 8e6c2f3 Compare May 26, 2025 12:17
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 26, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from 8e6c2f3 to 5f42c07 Compare May 26, 2025 13:44
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 26, 2025

/ci-gateway-api

@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 26, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch from 5f42c07 to b21ba92 Compare May 30, 2025 07:52
@aanm
Copy link
Copy Markdown
Member Author

aanm commented May 30, 2025

/test

@aanm aanm force-pushed the pr/move-logrus-to-slog branch 2 times, most recently from 0130b01 to 658fa89 Compare May 30, 2025 09:32
@aanm aanm added release-note/major This PR introduces major new functionality to Cilium. and removed release-note/misc This PR makes changes that have no direct user impact. labels Jun 3, 2025
Copy link
Copy Markdown
Member

@sayboras sayboras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for gateway-api and envoy packages.

Copy link
Copy Markdown
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks 🙏

Copy link
Copy Markdown
Contributor

@ti-mo ti-mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

aanm added 3 commits June 4, 2025 12:04
Add a multihandler slog.Handler so that we can add multiple handlers for
one instance of slog.Logger. This is necessary to keep existing Cilium
functionality that can log one message into multiple logger.

Signed-off-by: André Martins <[email protected]>
With this commit we migrate the remaining Cilium code base to use slog
and stop relying on logrus.

Signed-off-by: André Martins <[email protected]>
Add a detector in the CI pipeline to catch duplicate attributes in
slog logs. This prevents ambiguous or conflicting keys in structured logs,
ensuring cleaner and more reliable log output. It also helps maintain
consistency and simplifies downstream log processing and analysis.

Signed-off-by: André Martins <[email protected]>
@aanm aanm force-pushed the pr/move-logrus-to-slog branch from 4ac9df1 to 13e5b77 Compare June 4, 2025 10:09
@aanm aanm enabled auto-merge June 4, 2025 10:09
@aanm
Copy link
Copy Markdown
Member Author

aanm commented Jun 4, 2025

/test

@aanm aanm requested a review from tklauser June 4, 2025 10:13
@aanm aanm disabled auto-merge June 4, 2025 11:07
@aanm aanm merged commit 332dffa into main Jun 4, 2025
321 of 323 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. feature/slog release-note/major This PR introduces major new functionality to Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.