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

[Feature] Support correct log levels #376

Open
jwillmer opened this issue Oct 15, 2024 · 0 comments
Open

[Feature] Support correct log levels #376

jwillmer opened this issue Oct 15, 2024 · 0 comments

Comments

@jwillmer
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant