Skip to content

Improve error messages when parsing malformed log entries #176

Description

@casks-mutters

When the parser encounters malformed or unexpected log lines, the error messages returned to the user are minimal (e.g., "Error parsing line"). This makes it difficult to diagnose issues in large datasets.
Request

Enhance the parsing error messages so they include:

  • The line number
  • A short explanation of what failed
  • Optional snippet of the problematic line (truncated if very long)

Example of improved message

Line 482: Failed to parse timestamp — expected RFC3339 format.
  → Raw: "2024/11/08 12:32 invalid timestamp | user: X"

Benefits

  • Faster debugging for users.
  • Easier identification of recurring log format issues.
  • More actionable output when running audits on CI.

Potential implementation details

  • Define specific error types for different parsing stages.
  • Create a small helper to format readable parsing errors.
  • Ensure sensitive fields (if any) can be redacted automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions