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

Allow configuration of the message key in structured logs #16241

Open
alexgokhale opened this issue Nov 28, 2024 · 1 comment · May be fixed by #16242
Open

Allow configuration of the message key in structured logs #16241

alexgokhale opened this issue Nov 28, 2024 · 1 comment · May be fixed by #16242
Labels
feature request Requests for new plugin and for new features to existing plugins waiting for response waiting for response from contributor

Comments

@alexgokhale
Copy link

Use Case

This feature would enable configuration of the message key used for structured logging, which currently defaults to slog.MessageKey (which is "msg".

A number of log ingestion pipelines rely on the key being "message".
It would be very helpful to be able to configure this value without having to rely on another tool, such as fluentbit, to transform the logs.

My current use case would benefit from not having to add this additional overhead, when it's arguably not necessary.

Expected behavior

This will allow a config option, structured_log_message_key, or similar, which when set to a different value, such as message (instead of the default msg), would produce structured logs in the following format:

{"time":"2024-11-27T22:31:08.995949Z","level":"INFO","message":"Loading config: telegraf.conf"}

Actual behavior

This functionality is currently not yet available, so the logs would continue to be produced as follows:

{"time":"2024-11-27T22:31:08.995949Z","level":"INFO","msg":"Loading config: telegraf.conf"}

Additional info

No response

@alexgokhale alexgokhale added the feature request Requests for new plugin and for new features to existing plugins label Nov 28, 2024
@alexgokhale alexgokhale linked a pull request Nov 28, 2024 that will close this issue
1 task
@srebhan
Copy link
Member

srebhan commented Dec 2, 2024

Hmmm wouldn't it be better then to simply change the key to message instead of adding a new option?

@srebhan srebhan added the waiting for response waiting for response from contributor label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins waiting for response waiting for response from contributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants