Time format with time zone in Home Assistant parser

Open Beginner friendly
#1,998 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@andreasbrett is already working on this.

Since Nov 9, 2026.

  • #2000 by @gilbsgilbs — closed without merging
  • #2002 by @andreasbrett — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start with the Home Assistant parser in the hub and inspect its timestamp pattern alongside the example log line in the issue. Check how the parser handles timestamps with fractional seconds and a timezone offset, then run the relevant parser validation or tests. Done means the supplied log line is parsed successfully with its timestamp and existing supported formats still work.

Written by the indexing model from the issue text.

Description

Describe the bug
The home Assistant parser fails in my case because the log has the time zone in the tilestamp whereas the parser doesn't expect this.

To Reproduce
I don't have any non-default settings regarding log format. Home Assistant runs in a container, crowdsec on the host.

Expected behavior
I clearly want the logs to be parsed.

Screenshots

line: 2026-11-07 18:32:15.251+01:00 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from ... (192.168.200.247). Requested URL: '/auth/login_flow/44165863569aa262be5d51e7f037cd58'. (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36 Edg/157.0.0.0)
        ├ s00-raw
        |       ├ 🔴 crowdsecurity/syslog-logs
        |       └ 🟢 crowdsecurity/non-syslog (+5 ~8)
        |               └ update evt.ExpectMode : %!s(int=0) -> 1
        |               └ update evt.Stage :  -> s01-parse
        |               └ update evt.Line.Raw :  -> 2026-11-07 18:32:15.251+01:00 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from ... (192.168.200.247). Requested URL: '/auth/login_flow/44165863569aa262be5d51e7f037cd58'. (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36 Edg/157.0.0.0)
        |               └ update evt.Line.Src :  -> /home/.../home-assistant.log
        |               └ update evt.Line.Time : 0001-01-01 00:00:00 +0000 UTC -> 2026-11-07 17:38:00.991955445 +0000 UTC
        |               └ create evt.Line.Labels.type : home-assistant
        |               └ update evt.Line.Process : %!s(bool=false) -> true
        |               └ update evt.Line.Module :  -> file
        |               └ create evt.Parsed.message : 2026-11-07 18:32:15.251+01:00 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from ... (192.168.200.247). Requested URL: '/auth/login_flow/44165863569aa262be5d51e7f037cd58'. (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36 Edg/157.0.0.0)
        |               └ create evt.Parsed.program : home-assistant
        |               └ update evt.Time : 0001-01-01 00:00:00 +0000 UTC -> 2026-11-07 17:38:00.992091047 +0000 UTC
        |               └ create evt.Meta.datasource_path : /home/.../home-assistant.log
        |               └ create evt.Meta.datasource_type : file
        ├ s01-parse
        |       ├ 🔴 crowdsecurity/appsec-logs
        |       ├ 🔴 LePresidente/authelia-logs
        |       ├ 🔴 crowdsecurity/caddy-logs
        |       ├ 🔴 crowdsecurity/home-assistant-logs
        |       ├ 🔴 gauth-fr/immich-logs
        |       ├ 🔴 LePresidente/jellyfin-logs
        |       ├ 🔴 LearningSpot/open-webui-logs
        |       ├ 🔴 crowdsecurity/sshd-logs
        |       └ 🔴 crowdsecurity/sshd-success-logs
        └-------- parser failure 🔴

Additional context
With the help of ChatGPT, I fixed the parser with this pattern:

pattern_syntax:
  TIMESTAMP: '%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND}(?:\.%{INT})?(?:%{ISO8601_TIMEZONE})?'
Dominant language
Python
Stars
257
Forks
235
Avg merge
2d 10h
Merged PRs (30d)
26

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from crowdsecurity/hub

All issues in crowdsecurity/hub

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.