Skip to content

registry: restore logstash formatter fields - #4971

Draft
thaJeztah wants to merge 1 commit into
distribution:mainfrom
thaJeztah:fix_logstash
Draft

thaJeztah wants to merge 1 commit into
distribution:mainfrom
thaJeztah:fix_logstash

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

relates to;

The logstash formatter was originally added in commit a75f0f2 using the
formatter provided by logrus at the time.

When that formatter was removed from logrus, commit 1d6c1a6 replaced it
with logrus-logstash-hook. However, the replacement instantiated
LogstashFormatter directly instead of using its DefaultFormatter, so
the Logstash-specific field mappings and default fields were no longer
configured.

Restore the intended logstash output by mapping "time" to "@timestamp"
and "msg" to "message", and by adding the default "@Version" and "type"
fields to the logger context. Keep caller information mapped to
"function", matching the previous formatter behavior.

Use the existing static-field handling for "@Version" and "type", so
explicitly configured values continue to take precedence over the
defaults.

@github-actions github-actions Bot added the dependencies Pull requests that update a dependency file label Sep 22, 2026
@thaJeztah

Copy link
Copy Markdown
Member Author

So ... turns out that logstash was borked since .. forever; this somewhat restores it, but given that it was broken since #2128, we could consider just doing the minimal from #4970 and possibly deprecate it.

cc @milosgajdos

Comment thread registry/registry.go Outdated
for k := range logFields {
fields = append(fields, k)
}
// fmt.Println(fields)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh; was debugging something; need to remove these

The logstash formatter was originally added in commit a75f0f2 using the
formatter provided by logrus at the time.

When that formatter was removed from logrus, commit 1d6c1a6 replaced it
with logrus-logstash-hook. However, the replacement instantiated
LogstashFormatter directly instead of using its DefaultFormatter, so
the Logstash-specific field mappings and default fields were no longer
configured.

Restore the intended logstash output by mapping "time" to "@timestamp"
and "msg" to "message", and by adding the default "@Version" and "type"
fields to the logger context. Keep caller information mapped to
"function", matching the previous formatter behavior.

Use the existing static-field handling for "@Version" and "type", so
explicitly configured values continue to take precedence over the
defaults.

Signed-off-by: Sebastiaan van Stijn <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant