Skip to content

Accidentally merging multiple JSON logs into one #1

@bnonce

Description

@bnonce

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions