Event contract
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | Export outcome time. |
| actor_role | Utf8 | Bounded actor role. |
| data_class | Utf8 | Approved classification such as internal or restricted. |
| row_count_band | Utf8 | Coarse export size band. |
| outcome | Utf8 | success, denied, or failed. |
| review_status | Utf8 | not_required, pending, approved, or escalated. |
Copy the query
SELECT
data_class,
actor_role,
COUNT(*) AS export_attempts,
SUM(CASE WHEN outcome = 'success' THEN 1 ELSE 0 END) AS completed_exports,
SUM(CASE WHEN outcome <> 'success' THEN 1 ELSE 0 END) AS unsuccessful_exports,
SUM(CASE WHEN review_status IN ('pending', 'escalated') THEN 1 ELSE 0 END)
AS open_reviews
FROM data_export_audit_events
WHERE timestamp_utc >= now() - INTERVAL '30 days'
GROUP BY data_class, actor_role
ORDER BY open_reviews DESC, unsuccessful_exports DESC;This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. The deterministic sample output is synthetic and reviewed separately; validate field types, thresholds, and business definitions against your own data. Read the testing methodology.
Query result
Open export reviews by data class
Restricted support exports create the largest current review queue.
| data_class | actor_role | export_attempts | completed_exports | unsuccessful_exports | open_reviews |
|---|---|---|---|---|---|
| restricted | support | 18 | 9 | 9 | 4 |
| internal | admin | 84 | 82 | 2 | 1 |
Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.
Reproduce the example
Download the public fixture
The JSON bundle includes the typed event contract, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.
How the SQL works
- 1Data classification and role produce policy-relevant groups.
- 2Open reviews remain separate from failed outcomes.
- 3A size band supports proportional review without copying export contents into telemetry.
Edge cases to decide
- Never log exported rows, filenames containing personal data, or signed download URLs.
- Approved service exports may need separate policy.
- Immutable source audit records and aggregate dashboards serve different retention needs.
Recommended dashboard
- Bars: open_reviews by data class
- Trend: completed_exports by role
- Table: escalated reviews in the restricted system
Alert guidance
Alert on an unapproved restricted export, repeated denied attempts, or an overdue review.
Read alert setupPut the recipe to work
Related instrumentation and guides
Continue the analysis
Analyze Authentication Failure Rate
Measure authentication failures by method and reason while keeping traffic volume and affected identities visible.
Open recipeAudit Privileged Actions with SQL
Summarize sensitive administrative actions, denied attempts, and review-required outcomes without collecting raw secrets or resource contents.
Open recipeDetect Suspicious Authentication Bursts
Find short authentication windows with repeated failures across many identities or coarse network sources.
Open recipeRun it on real events
Create a table, adapt the fields, and save the result
Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.