Skip to content

[Feature] Support correct log levels #376

Open
@jwillmer

Description

@jwillmer

Description of the feature
Ensure that the log is written with the correct log level. Currently all logs are sent as informational logs / not recognized.

2024-10-15.11:08:54 [WARN] ** [db-backup] Mongo Host 'db-fail' is not accessible, retrying.. (143420 seconds so far)
nc: bad address 'db-fail'

Log collectors like promtail don't recognize these tags by default and the critical logs will end up hidden. We experienced this since we only sync warning and error logs to our cloud endpoint. Only very complex modifications in the log collector will help:

      - regex:
          expression: "(?i)\\[(TRACE|DEBUG|INFO|WARN|ERROR|FAIL|FATAL|CRITICAL)\\]"
          target: log_level
      
      - replace:
          source: log_level
          expression: "TRACE"
          replacement: "trace"
          target: level
      
      - replace:
          source: log_level
          expression: "DEBUG"
          replacement: "debug"
          target: level
      
      - replace:
          source: log_level
          expression: "INFO"
          replacement: "info"
          target: level
      
      - replace:
          source: log_level
          expression: "WARN"
          replacement: "warning"
          target: level
      
      - replace:
          source: log_level
          expression: "(ERROR|FAIL)"
          replacement: "error"
          target: level
      
      - replace:
          source: log_level
          expression: "FATAL"
          replacement: "fatal"
          target: level
      
      - replace:
          source: log_level
          expression: "CRITICAL"
          replacement: "critical"
          target: level

Benftits of feature
Reduce complexity of connected systems and prevent missed events - usually you don't monitor informational events.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions