Skip to content
Telemetry
Security and audit SQL recipe

Review sensitive data exports with SQL

Summarize export volume, denied attempts, data classifications, and review status without storing exported contents.

Intermediatedata_export_audit_eventsReviewed 2026-07-28Tested with Apache DataFusion 45.2.0

Reviewed by the Telemetry product team on . We checked the SQL syntax, required event fields, sample results, and limits on using the query. Who reviews this page

Question answered

Which sensitive export classes or actor roles require review?

For governance review, record the actor role, approved data class, row-count band, outcome, and review decision. Keep the exported payload out of the event.

Event schema

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampExport outcome time.
actor_roleUtf8Bounded actor role.
data_classUtf8Approved classification such as internal or restricted.
row_count_bandUtf8Coarse export size band.
outcomeUtf8success, denied, or failed.
review_statusUtf8not_required, pending, approved, or escalated.
DataFusion SQL

Copy the query

sql
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. We review the synthetic sample output separately. Check field types, thresholds, and counting rules 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_classactor_roleexport_attemptscompleted_exportsunsuccessful_exportsopen_reviews
restrictedsupport18994
internaladmin848221

Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.

Open export reviews by data class: static chart of synthetic open_reviews values from the Review sensitive data exports with SQL example result
Download this SVG chart of the sample results for an article, runbook, or design review. Please credit Telemetry.

Reproduce the example

Download the sample data

The JSON bundle includes the event schema with field types, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.

How the SQL works

  1. 1Data classification and role produce policy-relevant groups.
  2. 2Open reviews remain separate from failed outcomes.
  3. 3A size band supports proportional review without copying export contents into telemetry.

Edge cases to check

  • 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 setup

Set up the events this query needs

Related instrumentation and guides

Continue the analysis

Run it on your 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.

Get an API key