Skip to content

Traefik parser fails to parse access log entries when backend URL uses h2c:// #1966

Done

Description

@comchk

Summary

The CrowdSec Traefik access log parser fails to parse valid Traefik access log entries when the backend server URL uses the h2c:// scheme. Replacing h2c:// with http:// in an otherwise identical log line results in successful parsing.

This appears to be a parser compatibility issue with Traefik access logs for services using cleartext HTTP/2 (h2c).

Environment

  • CrowdSec image: crowdsecurity/crowdsec:v1.7.8
  • Traefik: v3.7.13
  • Parser: crowdsecurity/traefik-logs version 1.5, up to date
  • Traefik access log format: CLF
  • NetBird service routed through Traefik using an h2c backend
  • CrowdSec and Traefik share the traefik-logs Docker volume

Example access log entry

The following line is taken from the Traefik access log:

192.168.192.1 - - [27/Oct/2026:19:05:09 +0000] "POST /signalexchange.SignalExchange/Send HTTP/2.0" 200 5 "-" "-" 7520 "netbird-grpc@docker" "h2c://172.18.0.11:80" 0ms

The request is a successful HTTP/2 request to the NetBird signal exchange service. Traefik records the backend URL as h2c://172.18.0.11:80.

Expected behavior

The parser should successfully parse this valid Traefik access log entry, including the request metadata and backend URL, so that the event can continue through CrowdSec's normal parsing and enrichment stages.

Actual behavior

Running:

docker exec crowdsec cscli explain \
  --file /tmp/netbird-original.log \
  --type traefik

with the original log line produces:

s01-parse
  ...
  🔴 crowdsecurity/traefik-logs
-------- parser failure

The same line, with only the backend URL changed from h2c://172.18.0.11:80 to http://172.18.0.11:80, parses successfully:

s01-parse
  ...
  🟢 crowdsecurity/traefik-logs (+27 ~2)
...
parser success, ignored by whitelist (private ipv4/ipv6 ip/ranges)

A separate Dockhand access log entry using a conventional http:// backend URL also parses successfully with the same parser.

Relevant parser definition

The installed parser defines:

pattern_syntax:
  TRAEFIK_SERVER_URL: '(%{URI}|\-)'

The main CLF parsing pattern includes:

pattern: '%{NGINXACCESS2} %{NUMBER:number_of_requests_received_since_traefik_started} "%{DATA:traefik_router_name}" "%{TRAEFIK_SERVER_URL:traefik_server_url}" %{NUMBER:request_duration_in_ms}ms'

The failure appears to be associated with the TRAEFIK_SERVER_URL field. The exact underlying cause has not yet been confirmed.

Impact

  • Access log lines for requests routed to h2c backends are reported as unparsed by the Traefik parser.
  • Such lines may therefore miss the normal parsing and enrichment performed by CrowdSec.
  • The observed test line originates from a private IP address and is subsequently whitelisted when parsing succeeds. This whitelist behavior is separate from the parser failure.
  • No conclusion has been established that this issue causes missed detections in any particular attack scenario.

Reproduction steps

  1. Configure Traefik to route requests to a backend using the h2c:// scheme.
  2. Capture a CLF access log entry containing that backend URL.
  3. Run cscli explain --file <sample-file> --type traefik against the original line.
  4. Change only the backend URL scheme from h2c:// to http:// in a copy of the sample line.
  5. Run the same parser diagnostic against the modified line.
  6. Observe that the original line fails parsing while the modified line parses successfully.

Question

Should the crowdsecurity/traefik-logs parser explicitly support h2c:// backend URLs? If so, could the TRAEFIK_SERVER_URL pattern be updated to accept this scheme?
The issue is reproducible with the installed parser, but the precise reason the current %{URI} pattern rejects the original line has not been independently established.

(supported by ChatGPT)
/kind enhancement

Activity

  1. github-actions commented on Oct 28, 2026

    @github-actions

    @comchk: Thanks for opening an issue, it is currently awaiting triage.

    In the meantime, you can:

    1. Check Crowdsec Documentation to see if your issue can be self resolved.
    2. You can also join our Discord.
    3. Check Releases to make sure your agent is on the latest version.
    Details

    I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

  2. github-actions commented on Oct 28, 2026

    @github-actions

    @comchk: There are no 'kind' label on this issue. You need a 'kind' label to start the triage process.

    • /kind feature
    • /kind enhancement
    • /kind refactoring
    • /kind bug
    • /kind packaging
    Details

    I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions