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

Accidentally merging multiple JSON logs into one #1

Open
bnonce opened this issue Feb 21, 2024 · 0 comments
Open

Accidentally merging multiple JSON logs into one #1

bnonce opened this issue Feb 21, 2024 · 0 comments

Comments

@bnonce
Copy link

bnonce commented Feb 21, 2024

We've a case where coroot-node-agent (logparser) accidentally merges multiple json logs into one but we expect to receive them one-by-one.
Output:

{"context":"App:TypeOrmTransactionContext","level":"debug","timestamp":"2024-02-21T12:35:48.232Z","ms":"+1ms","span_id":"2aa1bcfe9bc837f2","trace_id":"1167fdf089bce248aa87fddee93eedff","msg":"..."}
{"context":"App:TypeOrmTransactionContext","level":"debug","timestamp":"2024-02-21T12:35:48.239Z","ms":"+7ms","span_id":"2aa1bcfe9bc837f2","trace_id":"1167fdf089bce248aa87fddee93eedff","msg":"..."}
{"context":"App:TypeOrmTransactionContext","level":"debug","timestamp":"2024-02-21T12:35:48.239Z","ms":"+0ms","span_id":"2aa1bcfe9bc837f2","trace_id":"1167fdf089bce248aa87fddee93eedff","msg":"..."}

We fixed this issue by changing the order of the json fields to get the timestamp first (to pass this condition https://github.com/coroot/logparser/blob/main/multiline.go#L123).
But it would be nice to detect json correctly and not depend on the order of the fields.

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

No branches or pull requests

1 participant