diff --git a/CHANGELOG.md b/CHANGELOG.md index 226a2ca..adb3376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,40 @@ le projet suit SemVer. ## [Non publié] +### Corrections + +- Traçage asynchrone (#37, audit du 04/11) : les fonctions `async def` + arrivées après la v0.2.0 (`indexer.py`, `service.py`, + `outputs/syslog.py`) portaient `@traced`, qui journalise la sortie + avant l'`await`, ou aucun décorateur. Elles passent à `@atraced` ; un + test (`tests/test_tracing.py::TestRegleAtraced`) fait désormais + respecter la règle sur tout `src/` (seules exceptions : méthodes + abstraites, signatures de Protocol, générateurs asynchrones). + +### Tests + +- Couverture des sorties `victorialogs` (#14) et `http` (#24) remontée à + 100 % (audit du 04/11 : 94 % et 97 %) : santé `http` en 5xx et en 4xx, + aide `_liste_virgules` ; garde-fou de `mode` redondant avec le schéma + commun retiré de `VictoriaLogsOutput`. + +### Sécurité + +- Identifiants écrits dans l'URL masqués dans les journaux (#5, audit du + 04/11) : avec `hosts => "http://user:secret@hote"`, le mot de passe + sortait en clair dans le DEBUG de sortie en exception des décorateurs + de traçage (les messages httpx citent l'URL) et dans le DEBUG de + signature de la sortie `doris`. Nouvelle fonction + `tracing.masquer_identifiants` (`http://***@hote`), appliquée par + `@traced`/`@atraced`, `doris` et `gelf` ; test de non-fuite sur toutes + les sorties HTTP du registre (`tests/test_fuites_identifiants.py`). + ### Documentation +- Gabarits d'exemple ajoutés aux sections `openobserve` (#16), + `quickwit` (#15) et `stdout` (#32) de `docs/sorties.md` (audit du + 04/11). Nouveau garde-fou `tests/test_docs_sorties.py` : chaque sortie + du registre doit avoir sa section et un gabarit `output { … }`. - README largement repris (#117, suite de #115) : architecture, démarrage rapide (filtres JSON, enrichissement, pipelines `.conf`, plusieurs événements, `${VAR}`, échappement, DNS), indexation/DLQ/métriques/connexion, diff --git a/docs/sorties.md b/docs/sorties.md index 27bc455..9654194 100644 --- a/docs/sorties.md +++ b/docs/sorties.md @@ -269,6 +269,18 @@ d'OpenObserve : `POST /api/{organization}/_bulk` (port 5080 par défaut), le `_index` de chaque ligne étant le stream. Authentification basic (`user`/`password` via `${VAR}`). +``` +output { + openobserve { + hosts => ["http://openobserve:5080"] + organization => "default" + index => "logs" + user => "${OO_USER}" + password => "${OO_PASSWORD}" + } +} +``` + | Option propre | Rôle | |---|---| | `organization` | organisation, dans le chemin (défaut : `default`) | @@ -349,6 +361,15 @@ indexé, doublon `create` et renvoi convergent, relus par SQL. Sous-classe du client commun sur l'API compatible Elasticsearch de Quickwit : `POST /api/v1/_elastic/_bulk` (port 7280 par défaut). +``` +output { + quickwit { + hosts => ["http://quickwit:7280"] + index => "logs" + } +} +``` + - **`create` seule** : c'est l'action par défaut ; toute autre action (`index`, `update`, `delete`) est refusée dès la compilation du pipeline (message traduit) et par `envoyer`. @@ -995,6 +1016,12 @@ Particularités : chaque document (gabarit sprintf) ; un label rendu vide est écarté (Loki refuse les valeurs vides) ; les documents sont regroupés en un flux par jeu de labels ; +- **avertissement de cardinalité** : un label dont le gabarit référence + un champ qui change à chaque document (`message`, `@timestamp`, `id`, + `trace_id`, `request_id`, ports, IP… — liste + `CHAMPS_FORTE_CARDINALITE` de `outputs/loki.py`) déclenche un + avertissement au démarrage (un flux Loki par valeur) ; la + configuration reste acceptée ; - **ligne de log** : le document entier part en ligne (JSON, sans perte) ; l'horodatage vient du champ `@timestamp` du document (ISO 8601), l'heure d'envoi sinon, en nanosecondes ; les lignes d'un même @@ -1016,6 +1043,195 @@ Banc de conformité contre Grafana Loki 3.7.9 en conteneur documents retrouvés par LogQL avec leurs labels de flux, horodatage du document respecté. Fixture du banc commun (#9) en plus. +## Sortie `greptimedb` (issue #19) + +GreptimeDB (port HTTP 4000 par défaut) lit le NDJSON `_bulk` du client +commun (#11) sur `POST /v1/elasticsearch/_bulk` ; le `_index` de chaque +ligne d'action est la **table**, créée à la première écriture. + +``` +output { + greptimedb { + hosts => ["http://greptimedb:4000"] + index => "logs" + user => "${GREPTIME_USER}" + password => "${GREPTIME_PASSWORD}" + } +} +``` + +Aucune option propre : seules les options communes s'appliquent +(authentification basique `user`/`password` si le serveur l'exige). + +Particularités (observées contre GreptimeDB 1.3.0) : + +- **insertions seules** : `index` (défaut) et `create` ; `update` et + `delete` sont refusées dès la compilation (le serveur les rejette en + 400) ; `_id` ignoré avec un avertissement (non stocké) ; +- **éléments sous la clé `create`** : chaque élément de `items[]` est + rapporté sous `create`, même pour un `index` ; la sortie le relit sous + l'action envoyée avant l'analyse commune ; +- **lot atomique** : une ligne invalide fait rejeter **tout** le lot en + HTTP 400 sans rien écrire ; la sortie renvoie alors chaque document + **seul** — sans doublon possible, seul le fautif est refusé (DLQ si + configurée), avec la raison donnée par le serveur ; +- **perte silencieuse sur conflit de type** : un champ qui contredit le + type déjà connu de la colonne n'est pas écrit alors que le serveur + répond `201` ; rien dans la réponse ne permet de le détecter — garder + des types stables par champ (`mutate { convert => … }`). + +Santé : `health()` interroge `GET /health` (`{}` quand le serveur est +prêt). + +Banc de conformité contre GreptimeDB 1.3.0 en conteneur, mode standalone +(`.github/workflows/conformite-greptimedb.yml`, +`tests/test_integration_greptimedb.py`). Fixture du banc commun (#9) en +plus. + +## Sortie `siglens` (issue #20) + +SigLens sépare l'ingestion (port 8081 par défaut), que vise cette +sortie, et la recherche (5122). Le NDJSON `_bulk` du client commun (#11) +est envoyé sur `POST /elastic/_bulk` ; l'index est créé à l'ingestion. + +``` +output { + siglens { + hosts => ["http://siglens:8081"] + index => "logs" + } +} +``` + +Aucune option propre : seules les options communes s'appliquent. Pas +d'authentification sur l'édition libre (`user`/`password` restent +transmis si un mandataire les exige). + +Particularités (observées contre SigLens 1.0.57) : + +- **actions `index` et `create` seules** : `update` et `delete` font + rejeter tout le lot (HTTP 400) ; elles sont refusées dès la + compilation du pipeline ; +- **pas de `_id`** : l'identifiant est accepté mais pas conservé (deux + documents de même `_id` sont gardés, un `create` en double n'est pas + refusé) ; un `document_id` est ignoré avec un avertissement ; +- **accusé par élément, sous la clé `index`** : `items[]` (201 indexé, + 400 `mapper_parse_exception` pour une ligne illisible), chaque élément + rapporté sous `index` même pour un `create`, `status` d'un échec placé + à côté de l'objet de l'action ; la sortie relit chaque élément sous + l'action envoyée (`pystashtemplate.outputs.relecture`). + +Santé : `health()` interroge `GET /elastic/` (la fiche « Elasticsearch » +de SigLens). + +Banc de conformité contre SigLens 1.0.57 en conteneur +(`.github/workflows/conformite-siglens.yml`, +`tests/test_integration_siglens.py`) : documents retrouvés par l'API de +recherche (port 5122). Fixture du banc commun (#9) en plus. + +## Sortie `otlp` (issue #22) + +OpenTelemetry OTLP/HTTP, journaux : `POST {hosts}/v1/logs` (port 4318 +par défaut), en protobuf (`application/x-protobuf`, défaut de la +spécification) ou en JSON. Un seul client couvre tous les récepteurs +OTLP (OpenTelemetry Collector, SigNoz, Uptrace, HyperDX/ClickStack, +OpenObserve, Quickwit, GreptimeDB, VictoriaLogs, Parseable…). Tampon, +réessais, DLQ et métriques sont ceux du client HTTP commun (#11). + +``` +output { + otlp { + hosts => ["http://otel-collector:4318"] + encoding => "protobuf" + resource => { "service.name" => "rsyslog" } + fields => { "host" => "resource.host.name" "program" => "attributes.process.executable.name" } + } +} +``` + +| Option propre | Rôle | +|---|---| +| `encoding` | `protobuf` (défaut) ou `json` | +| `resource` | Attributs de ressource fixes (défaut `service.name => "pystashtemplate"`) | +| `fields` | Correspondance champ de l'événement → cible du `LogRecord`, fusionnée avec la table par défaut | +| `scope` | Nom de la portée d'instrumentation (défaut `pystashtemplate`) | + +Cibles de `fields` : `body` (défaut : `message`), `time` +(`time_unix_nano`, ISO 8601 ou nombre ; défaut : `@timestamp`), +`severity` (`severity_text`/`severity_number`, nom usuel ou code syslog +0–7), `trace_id`/`span_id` (hexadécimal), `resource.`, +`attributes.`, `drop` (non transmis). Tout autre champ devient un +attribut du journal sous son propre nom. + +Particularités : + +- **groupement par ressource** : les journaux d'un lot sont regroupés + par jeu d'attributs de ressource ; `observed_time_unix_nano` est + l'heure d'envoi ; +- **accusé global** : OTLP ne rapporte pas d'erreur par journal ; 2xx + accepté, 400 permanent (DLQ), 429/5xx retentés ; puis + `partial_success` : si tout le lot est refusé, il part en DLQ ; si une + partie seulement l'est, les journaux refusés ne sont pas identifiables + (la spécification interdit de les renvoyer) — ils sont comptés dans la + métrique `rejected` et journalisés avec le message du serveur ; +- `compression => true` compresse le corps en gzip. + +Santé : `health()` envoie une requête OTLP vide (OTLP n'a pas de point +de santé) et renvoie le statut HTTP. + +Banc de conformité contre OpenTelemetry Collector contrib 0.164.0 en +conteneur, récepteur OTLP/HTTP et exportateur `file` +(`.github/workflows/conformite-otlp.yml`, `tests/test_integration_otlp.py`), +en protobuf, en JSON et compressé en gzip. Fixture du banc commun (#9) en plus. + +## Sortie `parseable` (issue #25) + +Parseable (port 8000 par défaut) reçoit un tableau JSON d'événements sur +`POST /api/v1/ingest` ; le jeu de données (« stream ») passe dans +l'en-tête `X-P-Stream` et il est créé s'il n'existe pas. Parseable aplatit +les champs imbriqués (`host.name` → `host_name`) et ajoute +`p_timestamp`. + +``` +output { + parseable { + hosts => ["http://parseable:8000"] + stream => "rsyslog" + user => "${PARSEABLE_USER}" + password => "${PARSEABLE_PASSWORD}" + } +} +``` + +| Option propre | Rôle | +|---|---| +| `stream` | Jeu de données visé, en-tête `X-P-Stream` (obligatoire) | +| `api_key` | Clé d'API, en-tête `X-API-Key` (Parseable Cloud / Enterprise) | +| `tenant_id` | Locataire, en-tête `X-P-Tenant-ID` (déploiements multi-tenant) | +| `tags` | Étiquettes ajoutées à chaque événement, en-têtes `X-P-Tag-` ; `{}` par défaut | + +Particularités (observées contre Parseable 3.2.6) : + +- **insertions seules** : action `index` seule, pas de `_id` (Parseable + ignore l'identifiant et l'index) ; +- **accusé global** : 200 sans corps si le lot est accepté, un message + texte sinon (`accuse_par_evenement=False`) : 400/404 = permanent (DLQ + si configurée) ; réseau, 429, 5xx = transitoire ; 401/403 (clé ou + droits refusés) = lot rendu à l'appelant ; +- **conflit de type** : pas une erreur — Parseable range la valeur dans + une colonne suffixée (`n` numérique puis `"texte"` → colonne + `n_utf8`) ; +- **jamais de lot vide** : Parseable 3.2.6 s'arrête net sur un tableau + vide. + +Santé : `health()` interroge `GET /api/v1/readiness` puis +`GET /api/v1/about` (`{"status": "ready", "version": …}`). + +Banc de conformité contre Parseable 3.2.6 (binaire officiel en mode +`local-store`, `.github/workflows/conformite-parseable.yml`, +`tests/test_integration_parseable.py`). Fixture du banc commun (#9) en +plus. + ## Sorties `file` et `stdout` (issue #32) Sorties locales, sans client : chaque document part en texte, rendu par @@ -1058,6 +1274,14 @@ connecteur). `codec` : `rubydebug` par défaut (comme le plugin Logstash) ou `json_lines`. `flush()` vide la sortie ; `close()` ne ferme pas la sortie standard. +``` +output { + stdout { + codec => "rubydebug" # ou json_lines + } +} +``` + ## Dead letter queue et rejeu (issue #7) Toute sortie qui a une DLQ (`dlq_path`) y écrit une ligne JSON par diff --git a/lang/ar_AR.po b/lang/ar_AR.po index aa4776c..6a445ca 100644 --- a/lang/ar_AR.po +++ b/lang/ar_AR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/bn_BD.po b/lang/bn_BD.po index d80d902..569408e 100644 --- a/lang/bn_BD.po +++ b/lang/bn_BD.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/cs_CZ.po b/lang/cs_CZ.po index 4f139b8..34086d6 100644 --- a/lang/cs_CZ.po +++ b/lang/cs_CZ.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/da_DK.po b/lang/da_DK.po index 94b94f7..1fea61b 100644 --- a/lang/da_DK.po +++ b/lang/da_DK.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/de_DE.po b/lang/de_DE.po index 3f7a64e..ede6da2 100644 --- a/lang/de_DE.po +++ b/lang/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/el_GR.po b/lang/el_GR.po index 41ad730..162fe63 100644 --- a/lang/el_GR.po +++ b/lang/el_GR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/en_US.po b/lang/en_US.po index 61aaade..9cbfab6 100644 --- a/lang/en_US.po +++ b/lang/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: deusyv\n" "Language-Team: English\n" @@ -92,11 +92,11 @@ msgstr "Prometheus metrics on http://{addr}:{port}/metrics" #: src/pystashtemplate/outputs/__init__.py msgid "sortie « {} » déjà inscrite au registre" -msgstr "output \"{}\": option \"{}\" is required" +msgstr "output \"{}\" already registered" #: src/pystashtemplate/outputs/__init__.py msgid "sortie « {} » inconnue — sorties disponibles : {}" -msgstr "unknown option \"{}\" for output \"{}\" (valid options: {})" +msgstr "unknown output \"{}\" — available outputs: {}" #: src/pystashtemplate/outputs/base.py msgid "action « {} » non supportée par cette sortie (supportées : {})" @@ -381,6 +381,10 @@ msgstr "kafka output: user is required with SASL" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "unreadable @timestamp {}, send time used instead" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "loki output: label {} uses high-cardinality field {} (one stream per value)" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "shutdown requested but the lotisseur was never started" @@ -643,10 +647,6 @@ msgstr "transport: network failure after {} attempt(s)" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "victorialogs output: list of fields expected, got {}" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "victorialogs output: unknown mode {} (bulk or jsonline)" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" @@ -868,6 +868,9 @@ msgstr "uuid ignored: missing target option" #~ msgid "options inconnues pour cette sortie : {}" #~ msgstr "unknown options for this output: {}" +#~ msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" +#~ msgstr "victorialogs output: unknown mode {} (bulk or jsonline)" + #~ msgid "Âge maximal d'un fichier rotaté" #~ msgstr "Maximum age of a rotated file" diff --git a/lang/fa_IR.po b/lang/fa_IR.po index d3e670f..96047ff 100644 --- a/lang/fa_IR.po +++ b/lang/fa_IR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/fi_FI.po b/lang/fi_FI.po index 55aeb85..b0e2ba3 100644 --- a/lang/fi_FI.po +++ b/lang/fi_FI.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/fr_FR.po b/lang/fr_FR.po index 3fb525b..be161e9 100644 --- a/lang/fr_FR.po +++ b/lang/fr_FR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/he_IL.po b/lang/he_IL.po index 3a51ca8..79d0034 100644 --- a/lang/he_IL.po +++ b/lang/he_IL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/hi_IN.po b/lang/hi_IN.po index c87014d..04bd87c 100644 --- a/lang/hi_IN.po +++ b/lang/hi_IN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/hu_HU.po b/lang/hu_HU.po index ce86123..3037898 100644 --- a/lang/hu_HU.po +++ b/lang/hu_HU.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/id_ID.po b/lang/id_ID.po index d5a2676..0308a8f 100644 --- a/lang/id_ID.po +++ b/lang/id_ID.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/it_IT.po b/lang/it_IT.po index 03bef86..cdcc1dc 100644 --- a/lang/it_IT.po +++ b/lang/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/ja_JP.po b/lang/ja_JP.po index c61b8a7..55908ed 100644 --- a/lang/ja_JP.po +++ b/lang/ja_JP.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/ko_KR.po b/lang/ko_KR.po index c122612..9ae0280 100644 --- a/lang/ko_KR.po +++ b/lang/ko_KR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/locale/en_US/LC_MESSAGES/pystashtemplate.mo b/lang/locale/en_US/LC_MESSAGES/pystashtemplate.mo index 3b1942d..55dd03f 100644 Binary files a/lang/locale/en_US/LC_MESSAGES/pystashtemplate.mo and b/lang/locale/en_US/LC_MESSAGES/pystashtemplate.mo differ diff --git a/lang/messages.pot b/lang/messages.pot index 54b6e47..dde17ec 100644 --- a/lang/messages.pot +++ b/lang/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "option {} du lotisseur : {} (doit être strictement positif)" msgstr "" @@ -639,10 +643,6 @@ msgstr "" msgid "transport : échec réseau après {} essai(s)" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/outputs/victorialogs.py msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" diff --git a/lang/nb_NO.po b/lang/nb_NO.po index df17cfe..5cca585 100644 --- a/lang/nb_NO.po +++ b/lang/nb_NO.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/nl_NL.po b/lang/nl_NL.po index 20a4116..446d8ec 100644 --- a/lang/nl_NL.po +++ b/lang/nl_NL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/pl_PL.po b/lang/pl_PL.po index cbd5e2b..39caba2 100644 --- a/lang/pl_PL.po +++ b/lang/pl_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/pt_BR.po b/lang/pt_BR.po index a77bec7..de35a7a 100644 --- a/lang/pt_BR.po +++ b/lang/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/ro_RO.po b/lang/ro_RO.po index 464aa74..661fc13 100644 --- a/lang/ro_RO.po +++ b/lang/ro_RO.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/ru_RU.po b/lang/ru_RU.po index 064d5f1..c064709 100644 --- a/lang/ru_RU.po +++ b/lang/ru_RU.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/sv_SE.po b/lang/sv_SE.po index 4bd3699..63e43b9 100644 --- a/lang/sv_SE.po +++ b/lang/sv_SE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/th_TH.po b/lang/th_TH.po index 99ffa29..59ec0ef 100644 --- a/lang/th_TH.po +++ b/lang/th_TH.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/tr_TR.po b/lang/tr_TR.po index de313fb..f958835 100644 --- a/lang/tr_TR.po +++ b/lang/tr_TR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/uk_UA.po b/lang/uk_UA.po index b062103..122ff9b 100644 --- a/lang/uk_UA.po +++ b/lang/uk_UA.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/vi_VN.po b/lang/vi_VN.po index 63726e4..f8e052e 100644 --- a/lang/vi_VN.po +++ b/lang/vi_VN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/lang/zh_CN.po b/lang/zh_CN.po index fcb63b8..396b257 100644 --- a/lang/zh_CN.po +++ b/lang/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: RsysLogstach\n" "Report-Msgid-Bugs-To: https://github.com/Mathilde-Team/RsysLogstach/issues\n" -"POT-Creation-Date: 2026-11-04 21:47+0000\n" +"POT-Creation-Date: 2026-11-04 22:26+0000\n" "PO-Revision-Date: 2026-10-24 17:02+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -381,6 +381,10 @@ msgstr "" msgid "@timestamp {} illisible, heure d'envoi utilisée" msgstr "" +#: src/pystashtemplate/outputs/loki.py +msgid "sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)" +msgstr "" + #: src/pystashtemplate/outputs/lotisseur.py msgid "arrêt demandé mais le lotisseur n'a jamais démarré" msgstr "" @@ -643,10 +647,6 @@ msgstr "" msgid "sortie victorialogs : liste de champs attendue, reçu {}" msgstr "" -#: src/pystashtemplate/outputs/victorialogs.py -msgid "sortie victorialogs : mode {} inconnu (bulk ou jsonline)" -msgstr "" - #: src/pystashtemplate/service.py #, python-brace-format msgid "entrée sflow : datagramme perdu erreur={error}" diff --git a/src/pystashtemplate/indexer.py b/src/pystashtemplate/indexer.py index 72a189d..fd4514b 100644 --- a/src/pystashtemplate/indexer.py +++ b/src/pystashtemplate/indexer.py @@ -35,7 +35,7 @@ from pystashtemplate.outputs.elasticsearch_bulk import SendOutcome as _SortieOutcome from pystashtemplate.outputs.opensearch import OpenSearchOutput from pystashtemplate.templates import CompiledTemplate, compile_template, render -from pystashtemplate.tracing import traced +from pystashtemplate.tracing import atraced, traced OPENSEARCH_TIMEOUT = 3.0 # secondes, timeout socket du client OpenSearch @@ -190,7 +190,7 @@ def __init__( options["ssl_key"] = client_key self.sortie = OpenSearchOutput(options, dlq=dlq) - @traced + @atraced async def health(self) -> dict[str, Any]: """Interroge le cluster (GET /) : sa version, ou lève l'erreur. @@ -229,7 +229,7 @@ def _document_id(self, doc: dict) -> str | None: rendered = render(self._document_id_template, doc, on_missing="empty") return rendered or None - @traced + @atraced async def _client(self): """Client httpx paresseux de la sortie (couture : template d'index). @@ -239,7 +239,7 @@ async def _client(self): """ return self.sortie._client_http() - @traced + @atraced async def send( self, doc: dict, @@ -308,7 +308,7 @@ async def send( return SendOutcome.INDEXED return SendOutcome.RETRYABLE - @traced + @atraced async def close(self) -> None: """Ferme proprement la sortie (et son client HTTP).""" await self.sortie.close() diff --git a/src/pystashtemplate/outputs/doris.py b/src/pystashtemplate/outputs/doris.py index 6449a7b..34fb390 100644 --- a/src/pystashtemplate/outputs/doris.py +++ b/src/pystashtemplate/outputs/doris.py @@ -71,7 +71,7 @@ from pystashtemplate.outputs import Capacites, enregistrer from pystashtemplate.outputs.elasticsearch_bulk import ElasticsearchBulkOutput, SendOutcome from pystashtemplate.outputs.schema import OptionSpec -from pystashtemplate.tracing import atraced, traced +from pystashtemplate.tracing import atraced, masquer_identifiants, traced # Doris : lettres, chiffres, `-` et `_`, 128 caractères au plus ; le # préfixe en laisse 33 au suffixe (`_` + 32 chiffres hexadécimaux). @@ -110,7 +110,9 @@ def __init__(self, user: str | None, password: str | None) -> None: def _signer(self, request: httpx.Request) -> httpx.Request: """Ajoute l'en-tête `Authorization` quand des identifiants sont configurés.""" - logger.debug("AuthStreamLoad._signer | {} {}", request.method, request.url.copy_with(query=None)) + logger.debug( + "AuthStreamLoad._signer | {} {}", request.method, masquer_identifiants(request.url.copy_with(query=None)) + ) if self._en_tete is not None: request.headers["Authorization"] = self._en_tete logger.debug("AuthStreamLoad._signer | sortie (authentifiée={})", self._en_tete is not None) diff --git a/src/pystashtemplate/outputs/gelf.py b/src/pystashtemplate/outputs/gelf.py index 76c079e..e72d8b1 100644 --- a/src/pystashtemplate/outputs/gelf.py +++ b/src/pystashtemplate/outputs/gelf.py @@ -84,7 +84,7 @@ from pystashtemplate.outputs.elasticsearch_bulk import ElasticsearchBulkOutput, SendOutcome from pystashtemplate.outputs.schema import OptionSpec from pystashtemplate.templates import compile_template, render -from pystashtemplate.tracing import atraced, traced +from pystashtemplate.tracing import atraced, masquer_identifiants, traced __all__ = ["GelfOutput", "decouper_udp", "message_gelf"] @@ -384,7 +384,7 @@ def __init__( self._compression = bool(options.get("compression", False)) url = urlsplit(self._hosts if "://" in self._hosts else f"{self._mode}://{self._hosts}") if not url.hostname: - logger.warning(_("sortie gelf : hôte absent de hosts {}"), self._hosts) + logger.warning(_("sortie gelf : hôte absent de hosts {}"), masquer_identifiants(self._hosts)) raise ValueError(_("sortie gelf : hosts doit nommer un hôte (ex. http://graylog:12201)")) self._hote = url.hostname self._port = url.port or _PORT_DEFAUT diff --git a/src/pystashtemplate/outputs/loki.py b/src/pystashtemplate/outputs/loki.py index 0288f1a..a0a38cc 100644 --- a/src/pystashtemplate/outputs/loki.py +++ b/src/pystashtemplate/outputs/loki.py @@ -40,6 +40,7 @@ from __future__ import annotations import json +import re import time from datetime import datetime, timezone from typing import Any, ClassVar @@ -58,6 +59,51 @@ # sinon (Loki veut des nanosecondes). CHAMP_HORODATAGE = "@timestamp" +# Champs dont la valeur change à (presque) chaque document : en faire un +# label crée un flux Loki par valeur (index qui explose, requêtes lentes). +# Un label qui en référence un (`%{message}`) déclenche un avertissement +# au démarrage — la configuration reste acceptée (#21). +CHAMPS_FORTE_CARDINALITE = frozenset( + { + "@timestamp", + "timestamp", + "message", + "msg", + "_id", + "id", + "uuid", + "trace_id", + "span_id", + "request_id", + "session_id", + "user_id", + "src_port", + "dst_port", + "client_ip", + "src_ip", + "dst_ip", + "pid", + } +) +_REFERENCE_CHAMP = re.compile(r"%\{([^}]+)\}") + + +@traced +def champs_forte_cardinalite(modele: Any) -> list[str]: + """Champs à forte cardinalité référencés par un gabarit de label. + + `%{[log][level]}` est ramené à son dernier segment (`level`) ; une + valeur non textuelle (constante) n'en référence aucun. + """ + if not isinstance(modele, str): + return [] + trouves: list[str] = [] + for reference in _REFERENCE_CHAMP.findall(modele): + champ = reference.strip().strip("[]").split("][")[-1] + if champ in CHAMPS_FORTE_CARDINALITE and champ not in trouves: + trouves.append(champ) + return trouves + @traced def _horodatage_ns(doc: dict[str, Any]) -> int: @@ -143,6 +189,13 @@ def __init__( self._labels_modele: dict[str, Any] = dict(options.get("labels") or {}) self._tenant = str(options["tenant_id"]) if options.get("tenant_id") else None super().__init__(options, dlq=dlq, transport=transport) + for nom, modele in self._labels_modele.items(): + for champ in champs_forte_cardinalite(modele): + logger.warning( + _("sortie loki : label {} sur le champ {} à forte cardinalité (un flux par valeur)"), + nom, + champ, + ) logger.debug("LokiOutput : labels {}, tenant {}", self._labels_modele, bool(self._tenant)) @traced diff --git a/src/pystashtemplate/outputs/syslog.py b/src/pystashtemplate/outputs/syslog.py index f94db41..81ff841 100644 --- a/src/pystashtemplate/outputs/syslog.py +++ b/src/pystashtemplate/outputs/syslog.py @@ -491,7 +491,7 @@ def __init__(self, hote: str, port: int, protocole: str, framing: str, contexte_ self._udp: Any = None logger.debug("_TransportReseau.__init__ | sortie") - @traced + @atraced async def ouvrir_udp(self) -> Any: """Ouvre un socket UDP vers la destination.""" transport, _ = await asyncio.get_event_loop().create_datagram_endpoint( @@ -500,7 +500,7 @@ async def ouvrir_udp(self) -> Any: ) return transport - @traced + @atraced async def ecrire(self, trames: list[bytes]) -> None: """Écrit les trames : datagrammes UDP, ou flux TCP reconnecté.""" if self._protocole == "udp": @@ -521,7 +521,7 @@ async def ecrire(self, trames: list[bytes]) -> None: self._writer.write(trame) await self._writer.drain() - @traced + @atraced async def fermer(self) -> None: """Ferme la connexion TCP ouverte.""" if self._writer is not None: diff --git a/src/pystashtemplate/outputs/victorialogs.py b/src/pystashtemplate/outputs/victorialogs.py index 81e4a07..aedab10 100644 --- a/src/pystashtemplate/outputs/victorialogs.py +++ b/src/pystashtemplate/outputs/victorialogs.py @@ -119,9 +119,8 @@ def __init__( qui n'est ni une chaîne ni une liste. """ super().__init__(options, dlq=dlq, transport=transport) + # `mode` est déjà validé par le schéma commun (valeurs valides : MODES). self._mode = str(options.get("mode", "bulk")) - if self._mode not in MODES: - raise ValueError(_("sortie victorialogs : mode {} inconnu (bulk ou jsonline)").format(self._mode)) self._parametres: dict[str, str] = {} for option, (parametre, defaut) in _CHAMPS.items(): valeur = _liste_virgules(options.get(option, defaut)) diff --git a/src/pystashtemplate/service.py b/src/pystashtemplate/service.py index f216fb6..35c3462 100644 --- a/src/pystashtemplate/service.py +++ b/src/pystashtemplate/service.py @@ -149,7 +149,7 @@ def analyser_syslog(trame: bytes) -> dict[str, Any] | None: return None -@traced +@atraced async def _lire_trame(lecteur: asyncio.StreamReader) -> bytes | None: """Lit UNE trame syslog TCP (RFC 6587) : octet-counting ou LF. @@ -181,7 +181,7 @@ async def _lire_trame(lecteur: asyncio.StreamReader) -> bytes | None: tampon += octet -@traced +@atraced async def _lire_requete(lecteur: asyncio.StreamReader) -> tuple[list[bytes] | None, bytes]: """Lit UNE requête HTTP POST ; rend les documents du corps. @@ -247,6 +247,7 @@ def liaison(self) -> tuple[str, int]: async def demarrer(self, service: "Service") -> None: """Ouvre l'écoute : chaque connexion nourrit la file du service.""" + @atraced async def servir(lecteur: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None: logger.debug("EntreeSyslogTcp.servir | connexion acceptée") self._connexions.add(writer) @@ -405,6 +406,7 @@ def liaison(self) -> tuple[str, int]: async def demarrer(self, service: "Service") -> None: """Ouvre l'écoute : chaque `POST` nourrit la file du service.""" + @atraced async def servir(lecteur: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None: logger.debug("EntreeHttp.servir | connexion acceptée") self._connexions.add(writer) diff --git a/src/pystashtemplate/tracing.py b/src/pystashtemplate/tracing.py index 98254dc..333bde3 100644 --- a/src/pystashtemplate/tracing.py +++ b/src/pystashtemplate/tracing.py @@ -29,6 +29,7 @@ from __future__ import annotations import functools +import re from typing import Any, Callable, Coroutine, TypeVar from loguru import logger @@ -37,6 +38,22 @@ A = TypeVar("A", bound=Callable[..., Coroutine[Any, Any, Any]]) +# Identifiants d'une URL (`schéma://utilisateur:secret@hôte`) : partie +# avant `@` de l'autorité, jusqu'au premier `/`, espace ou guillemet. +_IDENTIFIANTS_URL = re.compile(r"(?i)\b([a-z][a-z0-9+.\-]*://)[^\s/@'\"<>]+@") + + +def masquer_identifiants(texte: object) -> str: + """Texte de `texte` où les identifiants d'URL sont remplacés par `***`. + + `http://user:secret@hote:9200/x` devient `http://***@hote:9200/x` : + un message d'exception (httpx cite l'URL de la requête) ou une URL + journalisée ne laisse ainsi jamais passer un mot de passe écrit dans + `hosts` (#5). + """ + return _IDENTIFIANTS_URL.sub(r"\1***@", str(texte)) + + def traced(func: F) -> F: """Journalise l'entrée et la sortie (normale ou par exception) de `func`. @@ -69,7 +86,9 @@ def wrapper(*args, **kwargs): try: result = func(*args, **kwargs) except BaseException as exc: - logger.debug("{} | sortie (exception {}) : {}", func.__qualname__, type(exc).__name__, exc) + logger.debug( + "{} | sortie (exception {}) : {}", func.__qualname__, type(exc).__name__, masquer_identifiants(exc) + ) raise logger.debug("{} | sortie", func.__qualname__) return result @@ -105,7 +124,9 @@ async def wrapper(*args, **kwargs): try: result = await func(*args, **kwargs) except BaseException as exc: - logger.debug("{} | sortie (exception {}) : {}", func.__qualname__, type(exc).__name__, exc) + logger.debug( + "{} | sortie (exception {}) : {}", func.__qualname__, type(exc).__name__, masquer_identifiants(exc) + ) raise logger.debug("{} | sortie", func.__qualname__) return result diff --git a/tests/test_docs_sorties.py b/tests/test_docs_sorties.py new file mode 100644 index 0000000..387b2ff --- /dev/null +++ b/tests/test_docs_sorties.py @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +"""Chaque sortie du registre a sa page dans `docs/sorties.md` (critère commun des issues #12 à #33). + +Une page = un titre `## Sortie(s) …` qui nomme le plugin entre accents +graves, et au moins un gabarit `output { { … } }` dans la +section. Garde-fou ajouté après l'audit du 04/11 (pages manquantes pour +greptimedb, siglens, otlp, parseable ; gabarits d'openobserve, quickwit, stdout). +""" + +from __future__ import annotations + +import re +from pathlib import Path + +import pytest + +from pystashtemplate.outputs import REGISTRY + +DOC = Path(__file__).resolve().parents[1] / "docs" / "sorties.md" +# `null` est la sortie de référence du socle (#4), sans page dédiée. +SANS_PAGE = {"null"} + + +def _sections() -> dict[str, str]: + """Titre `## …` → texte de la section (sous-sections `###` comprises).""" + texte = DOC.read_text(encoding="utf-8") + morceaux = re.split(r"^(## .*)$", texte, flags=re.M) + return {morceaux[i]: morceaux[i + 1] for i in range(1, len(morceaux) - 1, 2)} + + +def _section_du_plugin(plugin: str) -> tuple[str, str] | None: + for titre, corps in _sections().items(): + if titre.startswith("## Sortie") and f"`{plugin}`" in titre: + return titre, corps + return None + + +@pytest.mark.parametrize("plugin", sorted(set(REGISTRY) - SANS_PAGE)) +def test_page_et_gabarit_pour_chaque_sortie(plugin: str) -> None: + trouvee = _section_du_plugin(plugin) + assert trouvee is not None, f"aucune section « ## Sortie `{plugin}` » dans docs/sorties.md" + _, corps = trouvee + assert re.search(rf"output\s*\{{\s*{re.escape(plugin)}\s*\{{", corps), ( + f"pas de gabarit output {{ {plugin} {{ … }} }}" + ) + + +def test_section_introuvable_pour_un_plugin_inconnu() -> None: + assert _section_du_plugin("plugin_qui_n_existe_pas") is None diff --git a/tests/test_fuites_identifiants.py b/tests/test_fuites_identifiants.py new file mode 100644 index 0000000..8323367 --- /dev/null +++ b/tests/test_fuites_identifiants.py @@ -0,0 +1,152 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +"""Aucun secret dans les journaux, même écrit dans l'URL (critère de #5). + +Audit du 04/11 : `hosts => "http://user:secret@hote"` faisait sortir le +mot de passe en clair dans le DEBUG de sortie en exception des +décorateurs de traçage (httpx cite l'URL dans ses messages) et dans le +DEBUG de signature de la sortie `doris`. Ces tests passent toutes les +sorties HTTP du registre, avec un secret dans l'URL et dans chaque +option d'authentification qu'elles acceptent, sur un faux serveur qui +répond 401, 400, 429 puis 500 ; aucun message, à aucun niveau, ne doit +contenir le secret. +""" + +from __future__ import annotations + +import asyncio +import re +from typing import Any + +import httpx +import pytest +from loguru import logger + +from pystashtemplate.outputs import REGISTRY +from pystashtemplate.outputs.elasticsearch_bulk import ElasticsearchBulkOutput +from pystashtemplate.tracing import atraced, masquer_identifiants, traced + +SECRET = "S3cr3tXYZ" +SORTIES_HTTP = sorted(nom for nom, cls in REGISTRY.items() if issubclass(cls, ElasticsearchBulkOutput)) + + +class TestMasquerIdentifiants: + @pytest.mark.parametrize( + ("texte", "attendu"), + [ + ("http://user:secret@hote:9200/x", "http://***@hote:9200/x"), + ("https://secret@hote", "https://***@hote"), + ("redis://:secret@redis:6379/0", "redis://***@redis:6379/0"), + ("amqp://u:p%40ss@mq/vhost", "amqp://***@mq/vhost"), + ("for url 'http://u:s@h/ready'", "for url 'http://***@h/ready'"), + ("a http://u:s@h1 b HTTP://v:t@h2", "a http://***@h1 b HTTP://***@h2"), + ("http://hote:9200/x", "http://hote:9200/x"), + ("courriel user@exemple.fr", "courriel user@exemple.fr"), + ("http://hote/chemin@version", "http://hote/chemin@version"), + ], + ) + def test_masquage(self, texte: str, attendu: str) -> None: + assert masquer_identifiants(texte) == attendu + + def test_accepte_tout_objet(self) -> None: + assert masquer_identifiants(httpx.URL("http://u:s@h/")) == "http://***@h/" + assert masquer_identifiants(["http://u:s@h"]) == "['http://***@h']" + + +def _journaux(action) -> list[str]: + messages: list[str] = [] + sink = logger.add(lambda m: messages.append(str(m)), level="TRACE") + try: + action() + finally: + logger.remove(sink) + return messages + + +class TestDecorateurs: + def test_traced_masque_le_message_d_exception(self) -> None: + @traced + def echoue() -> None: + raise ValueError(f"for url 'http://u:{SECRET}@h/'") + + def action() -> None: + with pytest.raises(ValueError): + echoue() + + messages = _journaux(action) + assert any("http://***@h/" in m for m in messages) + assert not any(SECRET in m for m in messages) + + def test_atraced_masque_le_message_d_exception(self) -> None: + @atraced + async def echoue() -> None: + raise ValueError(f"for url 'http://u:{SECRET}@h/'") + + def action() -> None: + with pytest.raises(ValueError): + asyncio.run(echoue()) + + messages = _journaux(action) + assert any("http://***@h/" in m for m in messages) + assert not any(SECRET in m for m in messages) + + +def _options(nom: str, cls: type) -> dict[str, Any]: + """Options avec le secret dans l'URL et dans les options d'authentification acceptées.""" + if nom == "http": + return {"url": f"http://u:{SECRET}@srv:1/x", "headers": {"Authorization": f"Bearer {SECRET}"}} + options: dict[str, Any] = {"hosts": f"http://u:{SECRET}@srv:1", "retry_max": 0, "retry_backoff": 0} + propres = set() + for classe in cls.__mro__: + propres |= set(getattr(classe, "OPTIONS_PROPRES", None) or {}) + if "api_key" in propres: + options["api_key"] = SECRET + elif "token" in propres: + options["token"] = SECRET + else: + options.update(user="u", password=SECRET) + return options + + +def _construire(nom: str, transport: httpx.MockTransport) -> ElasticsearchBulkOutput: + cls = REGISTRY[nom] + options = _options(nom, cls) + if nom == "parseable": + options["stream"] = "s" + for _ in range(5): + try: + return cls(options, transport=transport) + except ValueError as exc: + requise = re.search(r"option « (\w+) » est requise", str(exc)) + if requise is None: + raise + options[requise.group(1)] = "t" + raise AssertionError(nom) # pragma: no cover + + +@pytest.mark.parametrize("statut", [401, 400, 429, 500]) +@pytest.mark.parametrize("nom", SORTIES_HTTP) +def test_aucune_fuite_de_secret(nom: str, statut: int) -> None: + sortie = _construire(nom, httpx.MockTransport(lambda requete: httpx.Response(statut, text="erreur"))) + + async def scenario() -> None: + try: + try: + await sortie.envoyer({"message": "m"}) + await sortie.flush() + except Exception: # noqa: BLE001 - seul le contenu des journaux compte ici + pass + try: + await sortie.health() + except Exception: # noqa: BLE001 + pass + finally: + await sortie.close() + + messages = _journaux(lambda: asyncio.run(scenario())) + assert messages, "aucun journal : le test ne prouverait rien" + fuites = [m for m in messages if SECRET in m] + assert fuites == [] + + +def test_inventaire_des_sorties_http() -> None: + assert len(SORTIES_HTTP) >= 15 diff --git a/tests/test_outputs_http.py b/tests/test_outputs_http.py index 7c8329b..f86005b 100644 --- a/tests/test_outputs_http.py +++ b/tests/test_outputs_http.py @@ -177,3 +177,36 @@ async def scenario() -> dict[str, Any]: assert asyncio.run(scenario()) == {"status": "joignable"} assert str(requetes[0].url) == "http://recepteur:8080/logs" assert requetes[0].method == "GET" + + +def test_health_en_5xx_leve() -> None: + # Joignable mais en erreur serveur : la santé échoue (#24). + s = HttpOutput( + {"url": "http://recepteur:8080/logs"}, + transport=httpx.MockTransport(lambda request: httpx.Response(503)), + ) + + async def scenario() -> None: + try: + await s.health() + finally: + await s.close() + + with pytest.raises(httpx.HTTPStatusError): + asyncio.run(scenario()) + + +def test_health_en_4xx_reste_joignable() -> None: + # Un 4xx prouve que le récepteur répond : pas d'erreur de santé. + s = HttpOutput( + {"url": "http://recepteur:8080/logs"}, + transport=httpx.MockTransport(lambda request: httpx.Response(405)), + ) + + async def scenario() -> dict[str, Any]: + try: + return await s.health() + finally: + await s.close() + + assert asyncio.run(scenario()) == {"status": "joignable"} diff --git a/tests/test_outputs_loki.py b/tests/test_outputs_loki.py index 772d7ff..dc3c769 100644 --- a/tests/test_outputs_loki.py +++ b/tests/test_outputs_loki.py @@ -16,11 +16,12 @@ import httpx import pytest +from loguru import logger from pystashtemplate.dlq import LocalDeadLetterQueue from pystashtemplate.outputs import REGISTRY from pystashtemplate.outputs.elasticsearch_bulk import SendOutcome -from pystashtemplate.outputs.loki import LokiOutput +from pystashtemplate.outputs.loki import LokiOutput, champs_forte_cardinalite class FauxServeur: @@ -218,3 +219,31 @@ def test_labels_non_textels_convertis_en_chaines() -> None: envoyer(sortie(serveur, labels={"niveau": 3, "vide": None}), [{"message": "m"}]) # Un label vide est écarté ; une valeur non textuelle devient une chaîne. assert serveur.corps()["streams"][0]["stream"] == {"niveau": "3"} + + +def _avertissements(**options: Any) -> list[str]: + """Avertissements émis à la construction de la sortie.""" + messages: list[str] = [] + puits = logger.add(lambda m: messages.append(m.record["message"]), level="WARNING") + try: + sortie(FauxServeur(), **options) + finally: + logger.remove(puits) + return messages + + +def test_label_forte_cardinalite_avertit() -> None: + messages = _avertissements(labels={"job": "rsyslog", "ligne": "%{message}", "trace": "%{[otel][trace_id]}"}) + assert len(messages) == 2 + assert "ligne" in messages[0] and "message" in messages[0] + assert "trace" in messages[1] and "trace_id" in messages[1] + + +def test_labels_faible_cardinalite_sans_avertissement() -> None: + assert _avertissements(labels={"job": "rsyslog", "host": "%{host}", "niveau": 3}) == [] + + +def test_champs_forte_cardinalite_dedoublonnes_et_constantes_ignorees() -> None: + assert champs_forte_cardinalite("%{message}-%{message}-%{host}") == ["message"] + assert champs_forte_cardinalite(None) == [] + assert champs_forte_cardinalite("constante") == [] diff --git a/tests/test_outputs_victorialogs.py b/tests/test_outputs_victorialogs.py index 75bb537..c42331c 100644 --- a/tests/test_outputs_victorialogs.py +++ b/tests/test_outputs_victorialogs.py @@ -116,13 +116,13 @@ async def scenario() -> None: def test_mode_inconnu_refuse() -> None: # Schéma commun (#8) : énumération validée à l'instanciation. - with pytest.raises(ValueError, match="valeurs valides : bulk, jsonline \(reçu : loki\)"): + with pytest.raises(ValueError, match=r"valeurs valides : bulk, jsonline \(reçu : loki\)"): sortie(FauxServeur(), mode="loki") def test_stream_fields_de_mauvais_type_refuse() -> None: # Schéma commun (#8) : type validé à l'instanciation (str ou liste). - with pytest.raises(ValueError, match="type str ou list ou tuple attendu \(reçu : int\)"): + with pytest.raises(ValueError, match=r"type str ou list ou tuple attendu \(reçu : int\)"): sortie(FauxServeur(), stream_fields=3) @@ -179,3 +179,14 @@ async def scenario() -> None: with pytest.raises(httpx.HTTPStatusError): asyncio.run(scenario()) + + +def test_liste_virgules_chaine_liste_et_type_refuse() -> None: + # Le schéma commun filtre déjà les types ; l'aide garde son propre contrat (#14). + from pystashtemplate.outputs.victorialogs import _liste_virgules + + assert _liste_virgules("host,app") == "host,app" + assert _liste_virgules(["host", "app"]) == "host,app" + assert _liste_virgules(("host",)) == "host" + with pytest.raises(ValueError, match="liste de champs attendue, reçu int"): + _liste_virgules(3) diff --git a/tests/test_tracing.py b/tests/test_tracing.py index 67c2b7c..accde07 100644 --- a/tests/test_tracing.py +++ b/tests/test_tracing.py @@ -8,8 +8,10 @@ from __future__ import annotations +import ast import asyncio import inspect +from pathlib import Path import pytest from loguru import logger @@ -95,3 +97,57 @@ async def secret(mot_de_passe: str) -> str: finally: logger.remove(sink) assert not any("s3cret" in m or "S3CRET" in m for m in messages) + + +def _coroutines_de_src() -> list[tuple[str, ast.AsyncFunctionDef]]: + """Toutes les fonctions `async def` de `src/pystashtemplate` (chemin, nœud).""" + racine = Path(__file__).resolve().parents[1] / "src" / "pystashtemplate" + trouvees: list[tuple[str, ast.AsyncFunctionDef]] = [] + for chemin in sorted(racine.rglob("*.py")): + arbre = ast.parse(chemin.read_text(encoding="utf-8")) + for noeud in ast.walk(arbre): + if isinstance(noeud, ast.AsyncFunctionDef): + trouvees.append((f"{chemin.relative_to(racine)}:{noeud.lineno} {noeud.name}", noeud)) + return trouvees + + +def _decorateurs(noeud: ast.AsyncFunctionDef) -> set[str]: + return {ast.unparse(d).split("(")[0].rsplit(".", 1)[-1] for d in noeud.decorator_list} + + +def _exemptee(noeud: ast.AsyncFunctionDef) -> bool: + """Méthode abstraite, signature de Protocol (corps vide), générateur asynchrone, ou `atraced` lui-même.""" + if "abstractmethod" in _decorateurs(noeud) or noeud.name == "wrapper": + return True + corps = [n for n in noeud.body if not (isinstance(n, ast.Expr) and isinstance(n.value, ast.Constant))] + if not corps: + return True + # `atraced` attend une coroutine : il ne s'applique pas à un générateur asynchrone (`yield`). + return any(isinstance(n, (ast.Yield, ast.YieldFrom)) for n in ast.walk(noeud)) + + +class TestRegleAtraced: + """Critère de #37 : toutes les fonctions `async def` de `src/` sont décorées `@atraced`.""" + + def test_inventaire_non_vide(self) -> None: + assert len(_coroutines_de_src()) > 100 + + def test_aucun_traced_sur_une_coroutine(self) -> None: + # `@traced` sur une coroutine journalise la « sortie » avant même l'`await`. + fautives = [nom for nom, noeud in _coroutines_de_src() if "traced" in _decorateurs(noeud)] + assert fautives == [] + + def test_toutes_les_coroutines_sont_atraced(self) -> None: + manquantes = [ + nom for nom, noeud in _coroutines_de_src() if not _exemptee(noeud) and "atraced" not in _decorateurs(noeud) + ] + assert manquantes == [] + + def test_exemptions(self) -> None: + source = ( + "async def protocole(self):\n '''Signature seule.'''\n" + "async def generateur(self):\n yield 1\n" + "async def normale(self):\n return 1\n" + ) + noeuds = [n for n in ast.parse(source).body if isinstance(n, ast.AsyncFunctionDef)] + assert [_exemptee(n) for n in noeuds] == [True, True, False]