victorialogs datasource passes the trailing newline of a message to the parsers (traefik-logs 1.6 fails on every line)
I maintainer di solito rispondono entro 4 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 70/100
Direzione di ricerca
Il bug è nel datasource victorialogs: ll.Raw = entry.Message in pkg/acquisition/modules/victorialogs/run.go:51 passa un a capo finale ai parser. Confronta con il datasource syslog, che lo rimuove con strings.TrimSuffix (syslog/run.go:210,243), e verifica se loki (loki/run.go:61) richiede la stessa modifica. Il lavoro è completo quando un messaggio che termina con \n o \r\n arriva ai parser senza il terminatore, con un test che lo copra.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 15.1k
- Fork
- 726
- Merge medio
- 4g 23h
- PR unite (30g)
- 27
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crowdsecurity/crowdsec
-
needs/kind needs/triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
crowdsecurity/crowdsec#4849 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
kind/bug needs/triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
crowdsecurity/crowdsec#4847 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
kind/bug needs/triage os/linux
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
crowdsecurity/crowdsec#4836 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
[email protected]Apertaneeds/kind needs/triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
crowdsecurity/crowdsec#4842 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
MySQL: idle pool connections die after wait_timeout, log shows broken pipeForse già presa @AdzerKI l’ha presa 3 giorni fa. Apertakind/bug needs/triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
crowdsecurity/crowdsec#4840 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di crowdsecurity/crowdsec
Issue simili
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Apertaenhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
DaoCloud/DaoCloud-docs#7839 ·
I maintainer di solito rispondono entro 1 giorno
-
Type: Enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
projectdiscovery/urlfinder#167 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloverworks-hq/rumpty-cli#95 ·
I maintainer di solito rispondono entro 1 giorno