victorialogs datasource passes the trailing newline of a message to the parsers (traefik-logs 1.6 fails on every line)
メンテナーはふだん 4 日以内に返信
評価
調査の方向性
バグは victorialogs データソースにあります。pkg/acquisition/modules/victorialogs/run.go:51 の ll.Raw = entry.Message が、末尾の改行をパーサーに渡しています。syslog データソースが strings.TrimSuffix で取り除いている方法(syslog/run.go:210,243)と比較し、loki(loki/run.go:61)にも同じ変更が必要かを確認してください。\n または \r\n で終わるメッセージが、終端文字なしでパーサーに届き、それをカバーするテストがあれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happened?
Since the hub update of crowdsecurity/traefik-logs from 1.5 to 1.6 (crowdsecurity/hub#1978), not a single traefik access log
line read through the victorialogs datasource is parsed anymore (cscli metrics show parsers: 50.54k hits, 0 parsed).
The messages stored in VictoriaLogs end with \n (containers run by podman with the journald log driver keep the newline of each
stdout line in MESSAGE). The victorialogs datasource hands _msg to the parsers unchanged
(pkg/acquisition/modules/victorialogs/run.go:51, ll.Raw = entry.Message); the bytes.Trim(b, "\n") in
internal/vlclient/vl_client.go only applies to the JSON line of the response. traefik-logs 1.6 anchors its CLF pattern at the
end (... %{NUMBER:request_duration_in_ms}ms$), and Go's $ without the m flag does not match before a final newline, so every
line is rejected.
The other line based datasources remove the newline before the parsers see the line (v1.8.2):
| datasource | newline removed? |
|---|---|
| file | yes, bufio.Scanner / tail lines (file/run.go) |
| journalctl | yes, bufio.Scanner (journalctl/run.go:73) |
| docker | yes, bufio.Scanner (docker/run.go) |
| syslog | yes, strings.TrimSuffix(..., "\n") (syslog/run.go:210,243) |
| victorialogs | no, ll.Raw = entry.Message (victorialogs/run.go:51) |
| loki | no, ll.Raw = entry.Line (loki/run.go:61) |
So whether a parser matches depends on the datasource the line came through. cscli explain --log and the hub tests read from a
file and never see the newline, so an anchored pattern passes there and fails for victorialogs users.
What did you expect to happen?
The victorialogs datasource delivers the message without a trailing line terminator, like file, journalctl, docker and syslog
do, so that parsers behave the same regardless of the datasource. traefik-logs 1.6 then parses these lines as 1.5 did.
How can we reproduce it (as minimally and precisely as possible)?
-
Start VictoriaLogs and
crowdsecurity/crowdsec:v1.8.2so that crowdsec reaches VictoriaLogs on127.0.0.1:9428(e.g. both
in one pod), withCOLLECTIONS=crowdsecurity/traefik, then upgrade the hub to get traefik-logs 1.6
(the image ships 1.5):$ cscli hub update && cscli hub upgrade $ cscli parsers list | grep traefik crowdsecurity/traefik-logs ✔️ enabled 1.6 /etc/crowdsec/parsers/s01-parse/traefik-logs.yaml -
Ingest the same access log line twice, once with and once without a trailing newline:
$ L='203.0.113.10 - - [12/Nov/2026:07:19:02 +0100] \"GET /status.php HTTP/1.1\" 200 170 \"-\" \"curl/8.0\" 22517 \"app@docker\" \"http://192.0.2.20:8080\" 42ms' $ curl -H 'Content-Type: application/stream+json' --data-binary "{\"app\":\"traefik-nl\",\"msg\":\"$L\n\"}" \ 'http://127.0.0.1:9428/insert/jsonline?_stream_fields=app&_msg_field=msg' $ curl -H 'Content-Type: application/stream+json' --data-binary "{\"app\":\"traefik-plain\",\"msg\":\"$L\"}" \ 'http://127.0.0.1:9428/insert/jsonline?_stream_fields=app&_msg_field=msg' -
Run both through the parsers via the victorialogs datasource:
$ cscli explain --type traefik --dsn "victorialogs://127.0.0.1:9428/?query=app:traefik-nl&since=1h&limit=1" line: 203.0.113.10 - - [12/Nov/2026:07:19:02 +0100] "GET /status.php HTTP/1.1" 200 170 "-" "curl/8.0" 22517 "app@docker" "http://192.0.2.20:8080" 42ms ├ s00-raw | ├ 🔴 crowdsecurity/cri-logs | ├ 🔴 crowdsecurity/docker-logs | ├ 🔴 crowdsecurity/syslog-logs | └ 🟢 crowdsecurity/non-syslog (+5 ~7) ├ s01-parse | ├ 🔴 crowdsecurity/sshd-logs | ├ 🔴 crowdsecurity/sshd-success-logs | └ 🔴 crowdsecurity/traefik-logs └-------- parser failure 🔴 $ cscli explain --type traefik --dsn "victorialogs://127.0.0.1:9428/?query=app:traefik-plain&since=1h&limit=1" ... | └ 🟢 crowdsecurity/traefik-logs (+27 ~2)Note the empty line after
line:in the first case: that is the newline reaching the parser.
Results of the same test:
| traefik-logs | message | result |
|---|---|---|
| 1.6 | with \n |
failure |
| 1.6 | without \n |
success |
| 1.6 | with \n + pipe |
success |
| 1.5 | with \n |
success |
("pipe" = the workaround below.)
Anything else we need to know?
Suggested fix: strip a trailing \n / \r\n from the message in the victorialogs datasource, as the syslog datasource does.
The loki datasource takes the same path (entry.Line unchanged) and is probably affected as well; I have only tested victorialogs.
traefik-logs is just the first widely used parser to hit this: 15 of the 110 hub parsers with grok patterns end in $, among them
crowdsecurity/syslog-logs and crowdsecurity/http-logs.
Workaround: remove the newline in the acquisition query (works with the tail endpoint used in normal operation as well):
query: '<your query> | replace_regexp ("\n$", "") at _msg'
Analysis, reproduction and write-up done with AI assistance (Claude Code); I reviewed the report before posting.
Crowdsec version
$ cscli version
version: v1.8.2-3d369d64
Codename: alphaga
BuildDate: 2026-10-26_14:19:03
GoVersion: 1.27.1
Platform: linux
libre2: C++
User-Agent: crowdsec/v1.8.2-3d369d64-linux
Constraint_parser: >= 1.0, <= 3.0
Constraint_scenario: >= 1.0, <= 3.0
Constraint_api: v1
Constraint_acquis: >= 1.0, < 2.0
Built-in optional components: cscli_setup, datasource_appsec, datasource_cloudwatch, datasource_docker, datasource_file, datasource_http, datasource_journalctl, datasource_k8s-audit, datasource_kafka, datasource_kinesis, datasource_kubernetes, datasource_loki, datasource_s3, datasource_syslog, datasource_victorialogs, datasource_wineventlog, db_mysql, db_postgres, db_sqlite
The reproduction above used the official image crowdsecurity/crowdsec:v1.8.2.
OS version
$ cat /etc/os-release # inside the container
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.24.3
PRETTY_NAME="Alpine Linux v3.24"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
$ uname -srmo # host
Linux 6.18.60-1-lts x86_64 GNU/Linux
Enabled collections and parsers
$ cscli hub list -o raw # relevant items
name,status,version,description,type
crowdsecurity/geoip-enrich,enabled,0.5,"Populate event with geoloc info : as, country, coords, source range.",parsers
crowdsecurity/http-logs,enabled,1.4,"Parse more Specifically HTTP logs, such as HTTP Code, HTTP path, HTTP args and if its a static ressource",parsers
crowdsecurity/syslog-logs,enabled,1.1,,parsers
crowdsecurity/traefik-logs,enabled,1.6,Parse Traefik access logs,parsers
crowdsecurity/whitelists,enabled,0.3,Whitelist events from private ipv4 addresses,parsers
crowdsecurity/base-http-scenarios,enabled,1.4,http common : scanners detection,collections
crowdsecurity/traefik,enabled,0.2,traefik support: parser and generic http scenarios,collections
Acquisition config
$ cat /etc/crowdsec/acquis.d/traefik.yaml
source: victorialogs
url: https://victorialogs.example.org
query: '_SYSTEMD_UNIT:traefik.service SYSLOG_IDENTIFIER:traefik _msg:~"^[0-9a-fA-F.:]+ - "'
labels:
type: traefik
Config show
Not relevant here (the line fails in s01-parse, independent of the configuration); can be provided on request.
Prometheus metrics
$ cscli metrics show acquisition parsers # relevant rows
+-----------------------------------------------+------------+--------------+----------------+
| Source | Lines read | Lines parsed | Lines unparsed |
+-----------------------------------------------+------------+--------------+----------------+
| victorialogs:https://victorialogs.example.org | 62.97k | 7.07k | 55.90k |
+-----------------------------------------------+------------+--------------+----------------+
+----------------------------------------+---------+--------+----------+
| Parsers | Hits | Parsed | Unparsed |
+----------------------------------------+---------+--------+----------+
| child-child-crowdsecurity/traefik-logs | 50.54k | - | 50.54k |
| child-crowdsecurity/traefik-logs | 50.54k | - | 50.54k |
| crowdsecurity/non-syslog | 63.44k | 63.44k | - |
| crowdsecurity/traefik-logs | 50.54k | - | 50.54k |
+----------------------------------------+---------+--------+----------+
The 7.07k parsed lines of this source are sshd lines from a second victorialogs acquisition.
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.
One local whitelist parser in s02-enrich; not involved, the lines fail in s01-parse.
- 主要言語
- Go
- スター
- 15.1k
- フォーク
- 726
- 平均マージ
- 4日 23時間
- マージ済み PR(30日)
- 27
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crowdsecurity/crowdsec のほかの issue
-
needs/kind needs/triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
crowdsecurity/crowdsec#4849 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
kind/bug needs/triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
crowdsecurity/crowdsec#4847 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
kind/bug needs/triage os/linux
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
crowdsecurity/crowdsec#4836 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
[email protected]オープンneeds/kind needs/triage
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
crowdsecurity/crowdsec#4842 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
MySQL: idle pool connections die after wait_timeout, log shows broken pipe対応中かも @AdzerKI が 3 日前に担当しました。 オープンkind/bug needs/triage
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
crowdsecurity/crowdsec#4840 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
crowdsecurity/crowdsec の issue をすべて見る
似ている issue
-
tld-snapshot
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
awslabs/ferret-scan#1064 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
DaoCloud/DaoCloud-docs#7839 ·
メンテナーはふだん 1 日以内に返信
-
Ignore entry for RUSTSEC-2026-0002 no longer matches anything (`lru` is no longer in `Cargo.lock`)オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
influxdata/influxdb#27767 ·
メンテナーはふだん 1 日以内に返信
-
Type: Enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
projectdiscovery/urlfinder#167 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
gojue/ecapture#1100 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信