Added support for JSON based logging#11133
Conversation
|
Commit 3de339d71371ce8a7714b2f9c59686e67a5697ff does not contain "Signed-off-by". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
|
Please set the appropriate release note label. |
|
Please set the appropriate release note label. |
joestringer
left a comment
There was a problem hiding this comment.
Thanks for the contribution! I have a couple of minor comments below on the code.
Signed-off-by: Maxime VISONNEAU <maxime.visonneau@gmail.com>
| switch os.Getenv("INITSYSTEM") { | ||
| case "SYSTEMD": | ||
| fileFormat.FullTimestamp = true | ||
| default: | ||
| fileFormat.TimestampFormat = time.RFC3339 |
There was a problem hiding this comment.
What's the rational behind this removal?
There was a problem hiding this comment.
my former comment on this got removed, my bad. I assumed this statement was not actually used given that the logrus.Formatter is configured with an hardcoded value for disabling the timestamp 🤔 DisableTimestamp = true
There was a problem hiding this comment.
Well that explains stuff... and I thought it was because of the detection of os.Getenv("INITSYSTEM"). @borkmann you usually run cilium-agent standalone. Did you ever miss the lack of timestamps?
| switch os.Getenv("INITSYSTEM") { | ||
| case "SYSTEMD": | ||
| fileFormat.FullTimestamp = true | ||
| default: | ||
| fileFormat.TimestampFormat = time.RFC3339 |
There was a problem hiding this comment.
Well that explains stuff... and I thought it was because of the detection of os.Getenv("INITSYSTEM"). @borkmann you usually run cilium-agent standalone. Did you ever miss the lack of timestamps?
|
test-me-please |
This PR enable support for getting JSON based logs out of the binaries.
It can be set using either
or
--log-opt format=jsonThere is a slight issue related to some log lines that get written before the logger gets actually configured. I reckon it must also be the case when log-driver is set to syslog or the level is different than the default though.