2.9 KiB
2.9 KiB
Monitoring Setup - ASF test host
1. Logging
- Where: stdout of the systemd user unit
andreaslopfotografie-test, read withjournalctl --user -u andreaslopfotografie-test -f(asgitea-workflow). - Levels (from
shared/env):Logging__LogLevel__SlpModularCms.Website=Informationon test (one line per website 301 and 404;Warningon production later); everything else keeps the committed defaults;Microsoft.EntityFrameworkCore.Database.Commandstays atWarningso SQL parameters (e-mail addresses) are not logged. - Never logged: the setup token, passwords, tokens, full e-mail addresses. Website log lines are sanitised paths.
- Sample lines:
Website redirect 301 /Over-Mij -> /over-mij;Security event setup_token_rejected: setup token rejected on /api/v1/Setup/owner. - Sentry:
Observability__SentryDsn(website project DSN) andObservability__Environment=testinshared/env; the admin build gets the same DSN throughVITE_SENTRY_DSN_ASFand reports through/sentry-tunnel.
2. Alerting (Q4 = A), in the website's Sentry project, notification by e-mail to the project owner
Create these rules once, filtered on environment:test (the assistant did NOT create them; they change a shared Sentry project, so Bryan or the website session adds them, or asks for the sentry:sentry-create-alert skill to do it):
| Rule | Condition | Why |
|---|---|---|
| Setup token rejected | tag security_event:setup_token_rejected, 1+ events in 5 min |
someone guesses the first-admin token |
| Failed logins | tag security_event:failed_login, 10+ in 5 min |
brute force on the admin |
| Rate limit | tag security_event:rate_limit_triggered, 1+ in 5 min |
limiter hit; with forwarded headers this is per visitor |
| Migration failure | tag security_event:migration_failure, 1 event |
host cannot start; also /health goes silent |
| Unhandled errors | new issue in environment:test, level error or higher |
host or admin bug |
| Uptime | monitor https://test.andreaslop.nl/health every 5 min if Sentry uptime is available (otherwise any external pinger) |
the deploy only checks once |
Each alert event carries the tag via SecurityEventProcessor, so the rules survive message wording changes. The first rate_limit_triggered events also confirm whether forwarded headers work: the limiter should count real visitors, not 192.168.1.102.
3. Dashboards (Q5 = A)
None added. Use Sentry Issues filtered on environment:test, and on the Pi journalctl, systemctl --user status andreaslopfotografie-test, ls -l current.
4. Verification after the first deploy
- Open
/doesnotexist-> journald shows a 404 line. - POST a wrong
X-Setup-Tokento/api/v1/Setup/owner(before the first administrator exists) -> 401 and asetup_token_rejectedevent in Sentry with tagsecurity_event. - Stop the unit briefly -> uptime alert (if configured) and the deploy health check would fail.
- Check that no event contains the token or a full e-mail address.