Préréglages de tags : nouveaux groupes et fichier presets.json modifiable #14

Merged
claude Bot merged 3 commits from feat/filtres-systeme into main 2026-10-03 16:07:40 +02:00

Requested by Cédric

Before: the + Preset… menu in Settings › Filters only offered HTTP/HTTPS presets, hard-coded in web/app.js.

After: the menu is grouped into HTTP/HTTPS, System, Applications and General, with nine new presets, and the whole list lives in an editable text file:

  • System: SSH and logins (failures red, successes green), sudo commands, kernel (OOM, panics, segfaults, I/O errors, hung tasks), systemd services, firewall and fail2ban.
  • Applications: Docker and containers, databases (PostgreSQL, MySQL/MariaDB).
  • General: log levels (fatal/critical, info/notice, debug/trace) and IPv4 addresses.
  • File: presets.json (built into the binary) is served by GET /api/presets. PRESETS_FILE (default /data/presets.json) replaces it when present; it is read again each time Settings opens, and an invalid file shows an error and falls back to the built-in list. Names and labels are a string or { "en": …, "fr": … }.
  • Docs: docs/presets.md and docs/presets.fr.md describe each preset, how to mount your own file with docker-compose, and the file format. READMEs link to them; PRESETS_FILE added to the env tables, .env.example and docker-compose.yml (commented mount).

How: presets.go parses the file and checks every tag with the same validation as /api/tags (Go regexp, color, unique ids); the front builds the menu from the API response and picks the label in the current language.

Tested: presets_test.go covers the built-in file, a valid custom file and five invalid ones; all 25 patterns were run in JavaScriptCore against sample HTTP, sshd, sudo, kernel, systemd, UFW, fail2ban, Docker, PostgreSQL and MySQL lines. Known limit: the IPv4 preset also colors version numbers like 1.2.3.4. The UI could not be run here (port binding is blocked in this sandbox).

🤖 Generated with Claude Code

<!-- ccr-projects-attribution: {"github_login":"vblogio"} --> _Requested by **Cédric**_ Before: the **+ Preset…** menu in Settings › Filters only offered HTTP/HTTPS presets, hard-coded in `web/app.js`. After: the menu is grouped into HTTP/HTTPS, System, Applications and General, with nine new presets, and the whole list lives in an editable text file: - **System**: SSH and logins (failures red, successes green), sudo commands, kernel (OOM, panics, segfaults, I/O errors, hung tasks), systemd services, firewall and fail2ban. - **Applications**: Docker and containers, databases (PostgreSQL, MySQL/MariaDB). - **General**: log levels (fatal/critical, info/notice, debug/trace) and IPv4 addresses. - **File**: `presets.json` (built into the binary) is served by `GET /api/presets`. `PRESETS_FILE` (default `/data/presets.json`) replaces it when present; it is read again each time Settings opens, and an invalid file shows an error and falls back to the built-in list. Names and labels are a string or `{ "en": …, "fr": … }`. - **Docs**: `docs/presets.md` and `docs/presets.fr.md` describe each preset, how to mount your own file with docker-compose, and the file format. READMEs link to them; `PRESETS_FILE` added to the env tables, `.env.example` and `docker-compose.yml` (commented mount). How: `presets.go` parses the file and checks every tag with the same validation as `/api/tags` (Go regexp, color, unique ids); the front builds the menu from the API response and picks the label in the current language. Tested: `presets_test.go` covers the built-in file, a valid custom file and five invalid ones; all 25 patterns were run in JavaScriptCore against sample HTTP, sshd, sudo, kernel, systemd, UFW, fail2ban, Docker, PostgreSQL and MySQL lines. Known limit: the IPv4 preset also colors version numbers like `1.2.3.4`. The UI could not be run here (port binding is blocked in this sandbox). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude Bot added 1 commit 2026-10-03 16:01:15 +02:00
The preset menu is grouped (HTTP/HTTPS, System, Applications, General) and
gains SSH/logins, sudo, kernel, systemd, firewall/fail2ban, Docker,
databases, log levels and IPv4 addresses.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
claude Bot added 1 commit 2026-10-03 16:05:48 +02:00
The presets move from app.js to presets.json, built into the binary and
served by /api/presets. PRESETS_FILE (default /data/presets.json) replaces
the list when present; it is read again each time Settings opens and the
built-in list is used if it is invalid. docs/presets.md (EN/FR) explains
each preset and the file format.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
claude Bot changed title from WIP: Préréglages de tags couleur : système, applications, général to WIP: Préréglages de tags : nouveaux groupes et fichier presets.json modifiable 2026-10-03 16:05:57 +02:00
claude Bot added 1 commit 2026-10-03 16:07:31 +02:00
Existing tags.json files are unchanged; only new installs and "Restore
default tags" get the shorter list.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
claude Bot marked the pull request as ready for review 2026-10-03 16:07:35 +02:00
claude Bot merged commit 3466a29692 into main 2026-10-03 16:07:40 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vLab-BZH/logstream#14