Skip to content

6. Admin Log Monitoring Portal

The Admin Portal is the operations UI for the Audit (M6) and Monitoring (M7) layers: view logs, analyze stats, handle alerts, investigate incidents, and manage roles/four-eyes approvals. Stack: React SPA + Go API.

Component architecture

[React SPA Admin] --HTTPS/JSON--> [Go Admin API]
| (JWT from IdP/SSO, role=admin/dpo/security)
| |
| +--> [M6 Audit store (read-only)]
| +--> [M7 Detection (alerts)]
| +--> [M5 Access Control (roles, 4-eyes)]
v +--> writes self-audit for every action
[Recharts/ECharts] (Go API is the only layer touching data)

Four function groups

CodeGroupSummary
F1Log view & searchLog table, filters, keyset pagination, detail, verify-chain
F2Stats dashboardAccess-over-time charts, top actors, DENY rate
F3Alerts & investigationAlert list, subject timeline, incident grouping, containment
F4Roles & four-eyesRole management, approve/reject four-eyes requests

Database (DB) breakdown

TaskContentPriority
DB-ADM-01Log filter indexes: (ts), (actor,ts), (subject_ref,ts), (result,ts)P0
DB-ADM-02Materialized view aggregated hourly/daily for dashboardP1
DB-ADM-03alert table (M7) + index by status/severity/tsP0
DB-ADM-04incident table grouping alertsP1
DB-ADM-05approval_request table for four-eyes flowP0
DB-ADM-06admin_audit table (self-audit)P0
DB-ADM-07Read-replica/read-only credentials for Admin APIP1
DB-ADM-08Optimize keyset pagination at > 100M rowsP1
TABLE alert (
alert_id UUID PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
rule TEXT NOT NULL, -- BULK_READ|OFF_HOURS|...
severity TEXT NOT NULL, -- LOW|MEDIUM|HIGH
actor TEXT NOT NULL,
window_from TIMESTAMPTZ, window_to TIMESTAMPTZ,
evidence JSONB, -- related audit seq list
status TEXT NOT NULL DEFAULT 'open',
assignee TEXT, incident_id UUID NULL
);
CREATE INDEX ON alert(status, severity, created_at DESC);

API (Go) breakdown

Suggested: chi-router or gin, pgx/sqlc, JWT middleware via JWKS. The Go API is the only layer touching data.

TaskContentPriority
API-ADM-01Service skeleton: router, middleware, configP0
API-ADM-02Authn middleware (JWT/JWKS) + admin RBACP0
API-ADM-03GET /logs: filter + keyset paginationP0
API-ADM-05POST /logs/verify-chainP1
API-ADM-06GET /stats/* for dashboardP0
API-ADM-07GET/PATCH /alertsP0
API-ADM-08GET /subjects/{ref}/timelineP0
API-ADM-10POST /actors/{id}/revoke (calls M5, needs 4-eyes)P1
API-ADM-11GET/POST /approvals (four-eyes)P0
API-ADM-13Write self-audit for every write opP0
GET /api/v1/logs?actor=&result=&from=&to=&cursor=<seq>&limit=50
200 -> { items:[{seq,ts,actor,action,subject_ref,field,purpose,result}],
next_cursor:<seq|null> }
POST /api/v1/logs/verify-chain { from_seq, to_seq }
200 -> { ok:true } | { ok:false, broken_at:<seq> }
GET /api/v1/stats/access?from=&to=&bucket=hour|day
GET /api/v1/alerts?status=&severity=&cursor=&limit=
PATCH /api/v1/alerts/{id} { status, assignee }
GET /api/v1/subjects/{ref}/timeline
POST /api/v1/approvals/{id}/approve // approver != requester

Suggested source layout:

/cmd/adminapi/main.go -- bootstrap, router
/internal/auth -- JWT/JWKS middleware, RBAC
/internal/handler -- HTTP handlers F1..F4
/internal/service -- business logic
/internal/repo -- DB queries (pgx), read-only audit
/internal/audit -- self-audit (hash-chain)
/internal/model -- DTO/response

Frontend (React) breakdown

Suggested: Vite + TypeScript, React Router, TanStack Query, Recharts, a UI lib (shadcn/ui or Ant Design). OIDC auth.

TaskContentPriority
FE-ADM-01Project skeleton: Vite+TS, router, layoutP0
FE-ADM-02SSO/OIDC login + token refreshP0
FE-ADM-03API client + centralized 401/403 handlingP0
FE-ADM-04Logs page: table + filters + keyset paginationP0
FE-ADM-06Dashboard: access-over-time chartsP0
FE-ADM-08Alerts page: list + status changeP0
FE-ADM-09Investigation: subject timeline + incidentP1
FE-ADM-11Approvals page: approve/reject four-eyesP0
FE-ADM-13Role-based UI visibility (RBAC UI)P0

Screen map:

ScreenPathMain components
Dashboard/Summary cards, access chart, top actors
Logs/logsFilters, log table, detail drawer
Alerts/alertsAlert list, severity badge
Investigation/incidents/:idSubject timeline, alert list
Approvals/approvalsFour-eyes queue, approve/reject
Roles/rolesRole × field × action matrix

Skeleton code

The repo ships real skeleton code under skeleton/:

  • skeleton/api-go/ — Go Admin API skeleton (router, middleware, stub handlers, repo, self-audit).
  • skeleton/web-react/ — React SPA skeleton (Vite + TS, router, API client, F1–F4 pages).
  • skeleton/db/ — SQL scripts for tables/indexes/views.

See skeleton/README.md to run locally.

Sprint order

SprintContent
S1DB index/view + Go API skeleton + authn/RBAC + React skeleton
S2F1 Log view/search
S3F2 Dashboard
S4F3 Alerts & investigation
S5F4 Roles & four-eyes + self-audit
S6Hardening, export, realtime, testing & acceptance

Definition of Done (DoD)

  • Log search correct for all filters; keyset pagination stable at scale.
  • verify-chain correctly detects a tampered audit record.
  • Dashboard figures match verification queries on the DB.
  • Alerts change status, group into incidents, build subject timelines.
  • Approve button blocked when approver equals requester.
  • Every admin write action appears in admin_audit.
  • No endpoint/screen leaks real PII values.
  • API returns 403 when role lacks permission (even if UI hid the button).