Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable configuration of log formatting #503

Merged
merged 3 commits into from
Aug 8, 2023

Conversation

cbgbt
Copy link
Contributor

@cbgbt cbgbt commented Aug 8, 2023

Issue number:
Closes #493

Description of changes:
This provides the ability to specify log formatting options via helm. You can control:

  • The log format of the messages
  • Whether or not ANSI colors are enabled

See the updated README for more details

Testing done:
Launched a cluster with logging_ansi_enabled: "false" and logging_formatter: "full" and noted the logs:

[ec2-user@ip-10-0-0-27 bottlerocket-update-operator]$ kubectl logs brupop-agent-5cfsv
2023-08-08T05:55:58.598600Z  INFO apiserver::client::webclient: Created K8s API Server client using service port service_port=443
2023-08-08T05:55:58.695562Z  INFO run:create_shadow_if_not_exist:create_metadata_shadow: agent::agentclient: Brs has been created. brs_name="ip-192-168-68-199.us-west-2.compute.internal"

Then again with logging_formatter: "json":

[ec2-user@ip-10-0-0-27 bottlerocket-update-operator]$ kubectl logs brupop-agent-cmklc
{"timestamp":"2023-08-08T05:57:10.737628Z","level":"INFO","fields":{"message":"Created K8s API Server client using service port","service_port":"443"},"target":"apiserver::client::webclient"}

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@cbgbt cbgbt changed the title Log format option Enable configuration of log formatting Aug 8, 2023
Copy link
Member

@markusboehme markusboehme left a comment

Choose a reason for hiding this comment

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

🙌

Copy link
Contributor

@stmcginnis stmcginnis left a comment

Choose a reason for hiding this comment

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

I have not deployed, but code review-wise everything looks good and the test coverage gives me confidence. ;)

@cbgbt
Copy link
Contributor Author

cbgbt commented Aug 8, 2023

^ I forgot to run clippy 😅

Copy link
Contributor

@stmcginnis stmcginnis left a comment

Choose a reason for hiding this comment

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

I've had clippy point me at map way too often. :D

@cbgbt cbgbt merged commit 97d445c into bottlerocket-os:develop Aug 8, 2023
2 checks passed
@cbgbt cbgbt deleted the log-format-option branch August 10, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log Output Formating: --no-pretty-mode
3 participants