How to stream real-time security events into Delta Lake using Zerobus and Auto Loader
Summary
- Real-time ingestion of any security event source. Zerobus standardizes ingestion from firewalls, endpoints, cloud services, and third-party security tools into a single stream, eliminating the need to build and maintain custom adapters for each source.
- Automatic schema handling. Auto Loader detects schema changes automatically so new event fields are captured without pipeline interruptions, and old event structures remain queryable.
- Unified ACID guarantees. Events land in Delta Lake with full ACID properties, ensuring no duplicate events, data loss, or inconsistencies even if processes fail mid-ingestion.
- Query results immediately. As events arrive, they're queryable in real time with SQL or Spark, enabling threat detection rules, dashboards, and alerting to react within seconds.
How to stream real-time security events into Delta Lake using Zerobus and Auto Loader
Stream security events directly into Delta Lake in real time using Zerobus (for external event sources) and Auto Loader (for schema evolution), then query results immediately. This approach replaces event-by-event log shippers and multi-step data pipelines with a unified ingestion layer that preserves event fidelity, handles format changes transparently, and makes every event queryable the moment it arrives.
The advantage is simplicity and consistency. Instead of running separate agents to collect events from firewall, endpoint, and cloud services and trying to reconcile their formats, you stream all events through one standardized channel. Downstream, a single Delta table holds all events with a consistent schema, guaranteeing ACID correctness and enabling you to correlate across sources immediately.
Why real-time security event streaming
Traditional batch log collection creates a detection lag. Logs are shipped at intervals, are transformed in ETL pipelines, and only then become queryable for threat detection. By then, a breach might be significantly older. Real-time streaming closes that gap.
- Detection speed. When a firewall detects a port scan or an endpoint detects suspicious process execution, that event is queryable within seconds, not hours. Threat detection rules and dashboards react immediately.
- Correlation in motion. Real-time queries can correlate events across sources as they arrive: for example, match a failed login on a proxy with a suspicious network connection on an endpoint and flag the user before the next action.
- No message loss. Because Delta Lake provides ACID guarantees, streaming with Spark Structured Streaming ensures that no event is ingested twice and no event is lost, even if the pipeline crashes mid-stream.
- Simple at scale. Batch collectors scale linearly with the number of sources and destination systems. Streaming scales to any volume of events and any number of sources because events flow through a single channel.
Architecture: Zerobus, Auto Loader, and Delta Lake
The flow looks like this:
| Stage | Component | Role |
|---|---|---|
| Ingest | Zerobus | Standardizes events from external sources (firewalls, EDR, cloud services, syslog). Provides a unified API and handles credential management, rate limiting, and delivery guarantees. |
| Stream | Spark Structured Streaming | Reads events from Zerobus (or another source like Kafka, Pub/Sub) and writes them to a Delta Lake landing table in real time. Uses micro-batches for consistency. |
| Evolve schema | Auto Loader | Detects schema changes in incoming events and updates the Delta table schema automatically without stopping the stream. |
| Store | Delta Lake | ACID-compliant table with transaction logs. Old events remain queryable; new events are immediately available. |
| Detect threats | SQL or Spark queries, Dashboards, Alerting | Real-time rules (e.g., "flag repeated failed logins") and dashboards query events as they land. |
Getting started
- Connect your event sources to Zerobus. Register each source (firewall, endpoint tool, cloud service, syslog endpoint) with Zerobus. It handles credential storage, API polling, webhook ingestion, or direct stream connections depending on the source.
- Set up a landing table. In your lakehouse, create a
security_events_landingtable in Delta format. The schema can be minimal at first:timestamp,source_system,event_type,raw_event(as JSON). Auto Loader will evolve this as events arrive. - Build a Spark Structured Streaming pipeline. Write a Python or Scala job that reads events from Zerobus (or the message topic Zerobus publishes to) and writes to the Delta table. Enable Auto Loader to handle schema changes:
df = spark.readStream.format("cloudFiles") \ .option("cloudFiles.format", "json") \ .option("cloudFiles.schemaLocation", "/path/to/schema/checkpoint") \ .load("zerobus-events-path") \ .writeStream.format("delta") \ .option("checkpointLocation", "/path/to/checkpoint") \ .mode("append") \ .table("security_events_landing") - Parse and standardize. In a separate job or notebook, parse the landing table, extract key fields (timestamp, event type, source system, user, resource, action, outcome), and write to a
security_eventstable. This preserves the raw events but makes them uniformly queryable. - Query and alert. Use SQL or Spark to run threat detection rules on the standardized table. Examples: detect brute-force attempts, correlate endpoint and network events, or trigger alerts when sensitive data access is detected.
Operational considerations
- Checkpoint and recovery. Spark Structured Streaming uses a checkpoint directory to track processed events. Store this on cloud storage (not ephemeral local disk) so pipelines can recover from failure without reprocessing old events.
- Scaling and partitioning. Partition the Delta table by date and source system so queries are fast and old partitions can be archived. As event volume grows, cluster size scales horizontally.
- Schema governance. Use Unity Catalog to register the security events table and apply column-level access control to sensitive fields (source IP, user ID). Track schema changes in the catalog.
- Compression and retention. Compress older events (e.g., with Delta
ZORDER BY event_type) to optimize query performance. Archive aged events to cheaper storage tiers while keeping them queryable.
FAQs
What is the latency from event to query?
With Spark Structured Streaming, events are typically queryable within seconds of arrival, depending on your micro-batch interval configuration. For lower latency, you can adjust the trigger.processingTime option to reduce the batch interval.
How do I handle schema changes in event formats?
Auto Loader detects new fields and updates the table schema automatically. If a source adds new fields or changes field types, Auto Loader logs the change and continues streaming. Review schema changes regularly to ensure they align with your expectations.
Can I correlate events from multiple sources with different schemas?
Yes. In the parsing layer, normalize fields across sources: map src_ip, source_ip, and origin_ip to a common source_ip column. Then write to a unified schema, and queries can join across sources using this common column.
What happens if Zerobus or the pipeline fails?
Spark Structured Streaming stores a checkpoint with the offset of processed events. On restart, it resumes from where it left off. No events are lost or duplicated because Delta Lake transactions are atomic.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.