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

feat(logging): Implement structured logging #15751

Merged
merged 9 commits into from
Sep 6, 2024

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Aug 16, 2024

Summary

Structured logging is a machine-readable way of outputting logs and useful when automatically processing the produced logs.
This PR implements a structured log-target producing JSON formatted structured logs. It is output to a logfile, if specified, or to stderr otherwise similar to the usual text logger. Additionally, the PR deprecates the file and stderr targets and replaces them with a text target as that's what the output is. The decision to use a file or stderr is the done based on the logfile setting

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #8815

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Aug 16, 2024
@srebhan srebhan added area/logging ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Aug 21, 2024
@srebhan srebhan assigned DStrand1 and powersj and unassigned srebhan Aug 21, 2024
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

This looks great. My only question is around the config option values.

cmd/telegraf/agent.conf Outdated Show resolved Hide resolved
cmd/telegraf/agent.conf Outdated Show resolved Hide resolved
@srebhan
Copy link
Member Author

srebhan commented Aug 29, 2024

We should introduce a new logformat option and completely the logtarget one completely instead of reusing it.

@DStrand1 DStrand1 assigned srebhan and unassigned DStrand1 Aug 30, 2024
logger/event_logger.go Outdated Show resolved Hide resolved
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Sep 3, 2024

@DStrand1 DStrand1 merged commit c3e5319 into influxdata:master Sep 6, 2024
27 checks passed
@github-actions github-actions bot added this to the v1.32.0 milestone Sep 6, 2024
asaharn pushed a commit to asaharn/telegraf that referenced this pull request Oct 16, 2024
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logging feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support log json log format
4 participants