Skip to content

[feature]: Include Git Commit Short Hash in Log Messages #1084

Open
@ffranr

Description

@ffranr

We would like to enhance our log messages by including the git commit hash (first 5 characters, 1,048,576 combinations) in each log entry. This will help us accurately track the version of the software generating the logs, even if users only provide partial log snippets.

Proposed Log Format

2024-08-13 18:54:19.852 <commit_short_hash> [...] ...

Where <commit_short_hash> is replaced with the short commit hash (e.g. a1b42).

Motivation

Users frequently report issues by providing only a few log lines without including the entire log file or specifying the running version of the software. Including the short git commit hash in each log message will allow us to determine the exact version of the codebase that generated the logs, enabling quicker and more accurate troubleshooting.

Considerations

By adding the commit short hash to each log message, we should be aware that the log files will increase in size, as each log entry will have an additional 6 characters (5 for the commit hash and 1 for the space). Over time, this could lead to a significant increase in the total size of the log files, especially in systems that generate a high volume of logs.

Currently, the system manages log retention by truncating logs based on the total size of all log files. This means that increasing the size of individual log entries could result in log files reaching their maximum allowed size more quickly, leading to more frequent truncation.

We should review the current log retention policy to ensure it still meets our needs with the increased log file size. This might involve adjusting the total allowed log size or the number of log files retained.

(Log files are gzip compressed, which should efficiently handle the repeated commit short hash strings.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions