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

4.0.x Timestamp field comes first in generated JSON log output #6669

Conversation

darcy-harrison
Copy link
Contributor

Duplicate of #6642 except targeting release/4.0.x

Problem:

json-logging outputs JSON objects with undefined field order, but some log processing services (ex. Splunk) require the timestamp field to be within the first N characters of an object.

Solution:

The MapBuilder class now maintains insertion order (via LinkedHashMap) except that the "timestamp" field is always written first.

Result:

The output JSON from json-logging always has the timestamp field appear first within the object

@darcy-harrison darcy-harrison requested a review from a team as a code owner February 9, 2023 17:40
@gitpod-io
Copy link

gitpod-io bot commented Feb 9, 2023

Copy link
Member

@joschi joschi left a comment

Choose a reason for hiding this comment

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

@darcy-harrison Thank you for your contribution!

@joschi joschi merged commit 8550d49 into dropwizard:release/4.0.x Feb 10, 2023
@darcy-harrison darcy-harrison deleted the feature/4.0.x-json-logging-timestamp-first branch February 10, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants