Operations
Operational runbooks and guidelines for running SOCSuite. Audience: DevOps/Ops team.
Performance Targets (SLIs)
| Metric | Target | Measurement |
|---|---|---|
| API p95 latency | < 100 ms | Prometheus http_request_duration_seconds |
| DB p95 latency | < 50 ms | PostgreSQL pg_stat_statements |
| Error rate | < 1 % | 5xx responses / total requests |
| Throughput | > 1000 req/s | Prometheus http_requests_total |
:::info [Slow queries]
Queries with a runtime > 100 ms must always be analysed with EXPLAIN ANALYZE.
:::
Monitoring & Alerting
Key Metrics
- API: Request rate, latency histogram, error rate (5xx)
- PostgreSQL: Active connections, slow queries, replication lag
- Redis: Memory usage, connected clients, hit/miss rate
- OpenSearch: Cluster health, index size, ingest rate
Alert Recommendations
| Condition | Severity | Action |
|---|---|---|
| API p95 > 200 ms for 5 min | Warning | Check slow queries |
| API p95 > 500 ms for 5 min | Critical | Check scaling / DB |
| Error rate > 5 % for 2 min | Critical | Check logs, consider rollback |
| PostgreSQL connections > 80 % | Warning | Check connection pooling |
| OpenSearch cluster status = red | Critical | Check shards / disk space |
SIEM Pipeline Watchdog (built-in)
SOCSuite ships with a built-in detector-liveness watchdog (CronJob opensearch-watchdog, 5-minute cycle) that supervises the SIEM detection pipeline — the SIEM detector must not go silent after a reboot. The watchdog runs automatically with the deployment; no manual setup required.
| Supervision | Behavior on failure |
|---|---|
| Detector liveness (synthetic canary event) | Automatic restart of the OpenSearch pod (self-heal); on persistent failure, repeats on a 30-minute cadence |
| Detector workflow (enabled + delegation chain intact) | Automatic re-activation of the detector workflow (root-cause self-heal, ≤ 5 minutes) |
| Event ingestion (no satellite events > 15 min) | SIEM alert (watchdog-input-freshness) |
| Detection gap (no SIEM alerts > 2 h) | SIEM alert (watchdog-detection-gap) |
| Detector scan loop (massive duplicates) | alert + automatic restart |
Operation: Alerts appear in /siem/alerts like SIEM detections. The watchdog status is always visible via kubectl logs -n <namespace> job/opensearch-watchdog-<last-run-number>. A self-heal restart is normally the only visible effect (OpenSearch unavailable for ~1–2 min; events are buffered by the agent). After an OpenSearch restart (e.g. a deployment) SIEM detection is briefly degraded (startup race, ~2.5–7.5 min, self-healing) — the watchdog only alerts on persistent damage.
Database Schema Changes
:::error [No direct ALTER TABLE]
Never run ALTER TABLE directly on a running database.
All schema changes run as Kubernetes jobs.
:::
Process
- Create SQL file in
02_Initialisation/initdb/— idempotent (IF NOT EXISTS) - Create ConfigMap + Job in
infrastructure/k8s/base/jobs/ - Run deployment:
kubectl apply -k infrastructure/k8s/overlays/dev:::info [Details]
SQL patterns and further schema rules → 02_Initialisation/initdb/README.md
:::
:::warning [Current state (2026-11-08): no incremental migration jobs]
In practice, schema changes were previously written directly into the init
scripts (02_Initialisation/initdb/) — but those only run on fresh DB
volumes. Existing clusters never receive new columns that way (proof:
dev cluster, 4 API endpoints returning 500 pq: column does not exist —
ticket DEV-1231). The process described above (a separate job per change in
infrastructure/k8s/base/jobs/) is the target mechanic; until DEV-1231 is
implemented: always create new columns as their own idempotent job, not
just in an init script.
:::
Backup & Restore
PostgreSQL Backup
# Create backup
pg_dump -h <DB_HOST> -U <DB_USER> -Fc <DB_NAME> > backup_$(date +%Y%m%d).dump
# Verify backup (list structure)
pg_restore -l backup_$(date +%Y%m%d).dumpRestore
pg_restore -h <DB_HOST> -U <DB_USER> -d <DB_NAME> --clean --if-exists backup.dump:::warn [Restore tests] Regularly restore backups on a test instance to verify integrity. A backup that has never been tested is not a backup. :::
Retention
- Daily backups: 7 days
- Weekly backups: 4 weeks
- Monthly backups: 12 months
Audit Logs
The audit_logs table is append-only.
- No
UPDATEonaudit_logs - No
DELETEonaudit_logs - Retention: 7 years (GDPR Art. 30)
All write operations (POST / PUT / DELETE) must generate an entry in audit_logs.
The user_auditlog table is the user audit trail (Monitoring → User Logs) and is automatically purged after AUDIT_RETENTION_DAYS (default: 180 days). The full entries remain in audit_logs (7 years).
Log Management (OpenSearch)
Index Lifecycle
| Phase | Age | Action |
|---|---|---|
| Hot | 0–7 days | Active writes, full replicas |
| Warm | 7–30 days | Read-only, reduced replicas |
| Cold | 30–90 days | Minimal resources |
| Delete | > 90 days | Automatically deleted |
:::info [Audit logs exception]
audit_logs are subject to the 7-year retention (GDPR) and are not deleted after 90 days.
:::
Security Checklist
- No JWT in
localStorageorsessionStorage - No
dangerouslySetInnerHTMLwithout prior sanitization - No user input without validation (Frontend: Zod, Backend: own validation)
- No secrets as literals in code — always via environment variables / Kubernetes Secrets
- Never implement custom authentication — use Keycloak exclusively
- Clearly distinguish 403 and 404 (no RBAC leak via 404 on missing permission)
- MFA for
superadminandadminin production is mandatory
Rate Limiting
:::warn [Always Redis-backed] Rate limiting must be Redis-backed and therefore distributed. Never implement per-pod — with multiple instances the limit would be per pod, not per client, providing no meaningful protection. :::
Endpoints without authentication (auth: none in endpoints.yaml) must have a
rateLimit field in the Orchestrator declaration.
EUVD CVE API rate limiting (outbound)
The backend calls the ENISA EUVD API for CVE matching. The Azure Application Gateway in front of that API is aggressively protected (measured 2026-09-26, Dev_o-232):
| Behavior | Measured |
|---|---|
| Sustainable rate per egress IP | ~1 request / 10 s |
| Single 403 (no burst) | recovers in 3–6 s |
| Burst (e.g. 10 fast requests) | ~90–120 s IP ban (403) |
The CVEMatcher (apps/api/internal/service/cve_matcher.go) therefore throttles
centrally per pod — all matching paths (scan ingestion + stale scan
processor) share one instance:
- Minimum spacing between two EUVD requests: 10 s
- Backoff on 403/429/5xx: 10 s → 30 s → 90 s (4th attempt at t≈130 s, i.e. after a burst ban) — other 4xx statuses are not retried
- Expected scan duration: a full scan with N packages takes ~N × 10 s (2052 packages ≈ 5–6 h). That is the price of the ENISA rate limits; thanks to the processing lease (Dev_o-236), parallel scans of the same asset are not processed twice.
:::info [Configuration] The minimum spacing is configurable per deployment:
# Kubernetes: deployment environment variable (e.g. for a tighter/looser WAF
# budget on a different egress IP — demo vs. dev)
kubectl set env deployment/backend EUVD_MIN_REQUEST_INTERVAL=10s -n imvee-devFormat: time.Duration (5s, 30s, 1m). Default: 10s.
:::
:::info [Scan processing — concurrency cap (Dev_o-391)] Scan ingestion is processed in the backend as background work. So a scan storm (hundreds of parallel CVE matchings → DB pool exhaustion) does not slow down the whole backend, each pod processes only a limited number of scans at the same time — further scans wait in the queue (no data loss):
# Kubernetes: deployment environment variable
kubectl set env deployment/backend VULN_INGEST_CONCURRENCY=4 -n imvee-devFormat: integer > 0. Default: 4.
:::
:::info [EUVD product cache (Dev_o-395)]
EUVD queries are product-level (version filtering happens client-side), so
search results are cached per (product, vendor) in Postgres
(euvd_product_cache) — shared across all backend pods:
- TTL: 24 h (EUVD CVE data is updated daily) — after that, the product is re-queried exactly once
- Cache hit: bypasses the EUVD API entirely (no rate-limit slot, no WAF exposure)
- Empty results are cached too (the majority of packages have no known vulnerabilities)
- Cache failures (e.g. a DB error) do not fail the search — graceful fallback to the API
# Kubernetes: deployment environment variable
kubectl set env deployment/backend EUVD_CACHE_TTL=24h -n imvee-devFormat: time.Duration > 0 (1h, 24h, 72h). Default: 24h.
:::
Maintenance & Updates
Rolling Updates (Kubernetes)
# Check current rollout status
kubectl rollout status deployment/<DEPLOYMENT_NAME> -n imvee-dev
# Rollback on issues
kubectl rollout undo deployment/<DEPLOYMENT_NAME> -n imvee-devScaling
# Scale horizontally
kubectl scale deployment/<DEPLOYMENT_NAME> -n imvee-dev --replicas=<N>:::info [Pagination] List endpoints with >100 items have mandatory pagination. Default limit: 50, maximum: 1000. :::
See Also
- Dev Setup — Set up local development environment
- Architecture — System architecture and data flow
- API Reference — REST endpoints and Swagger UI
- Authentication — Keycloak, BFF pattern, security rules