Scenario D: Security events¶
Part of Streaming Transformations › Scenarios.
Goal¶
Security teams ingest large event streams, but only a few event types matter. Each relevant event needs context about the asset and any known threat, a normalized severity, and one row per owning team so that alerts reach the right people.
Transformations used¶
- Stream filtering on stream and dimension columns: keep relevant event types, and keep events whose threat-intelligence risk score is at or above a threshold.
- Stream enrichment: join the asset inventory and threat-intelligence tables, two dimension joins in one pipe.
- Custom scalar logic: a SQL UDF classifies the severity of each event.
- Lateral Flatten on the dimension: expand the asset’s array of owning teams after the join, so each team gets its own row.
Source data¶
Stream¶
The example uses these five records:
Dimension tables¶
The PIPE joins these dimension tables, refreshed periodically:
Target table¶
The PIPE lands transformed and filtered rows in this target table:
Transformation¶
The PIPE lands data in the target table. Events are enriched with a criticality level per asset and a risk score per IP address, joined from the dimension tables. A custom SQL UDF classifies the severity of each event based on the risk score and criticality. Relevant events are kept by filtering on the event type stream column, and the risk score dimension column.
Result¶
Querying the target table returns these rows:
| EVENT_TS | EVENT_TYPE | USER_NAME | SRC_IP | HOST | RISK_SCORE | IP_COUNTRY | CRITICALITY | SEVERITY | OWNER_TEAM |
|---|---|---|---|---|---|---|---|---|---|
| 2026-10-09 08:00:01 | auth_failure | bob | 203.0.113.7 | db-prod-01 | 90 | XX | critical | critical | dba |
| 2026-10-09 08:00:01 | auth_failure | bob | 203.0.113.7 | db-prod-01 | 90 | XX | critical | critical | secops |
| 2026-10-09 08:00:03 | privilege_escalation | carol | 198.51.100.20 | web-01 | 85 | DE | high | high | web-platform |
| 2026-10-09 08:00:05 | auth_failure | erin | 203.0.113.7 | laptop-77 | 90 | XX | NULL | high | NULL |
The login_success event from alice is filtered out by event type, and dave’s event is dropped because the risk score of 192.0.2.10 is 20, below the threshold of 70. The host laptop-77 isn’t in dim_assets, so erin’s event lands once with NULL criticality and owner team, and its severity is high because the critical branch requires a known critical asset.
Considerations¶
- Dimension data is a snapshot that refreshes periodically, so updates can take several minutes to appear. This works well for slow-moving reference data. Dynamic tables can be used as dimension tables.
- A pipe can join up to four dimension tables, and each table only once.
- Use
OUTER => TRUEon the dimension flatten. Otherwise events that match no asset are dropped. ERROR_LOGGINGcurrently can’t be enabled on the target table of a pipe that usesLATERAL FLATTEN.
See also¶
See Stream filtering, Stream enrichment, Custom scalar logic, and Lateral Flatten for more information on the transformations used in this scenario.
Previous: Scenario C: Industrial IoT telemetry · Next: Scenario E: Product and clickstream events