High-Level Architecture
Pipeline Stages
1. Capture
The capture stage collects raw events from the operating system. On Linux, this uses eBPF to intercept:- SSL/TLS traffic via uprobes on
SSL_writeandSSL_read - Process events via tracepoints on
sched_process_execandsched_process_exit - File operations via tracepoints on
sys_enter_openat - Network connections via tracepoints on
sys_enter_connectandsys_exit_connect
2. Decode
Raw captured bytes are transformed into structured events:| Decoder | Input | Output |
|---|---|---|
| HttpDecoder | SSL read/write bytes | HTTP request/response, AI events |
| SystemDecoder | Process/file/network raw events | OISP process, file, network events |
- Parses HTTP/1.1 requests and responses
- Correlates requests with responses using timing heuristics
- Detects AI providers from URLs and headers
- Handles streaming SSE responses (OpenAI, Anthropic)
- Reassembles chunked transfer encoding
3. Enrich
Events are enhanced with additional context:- HostEnricher: Adds hostname, OS, architecture
- ProcessTreeEnricher: Builds parent-child process relationships
- Future: DNS resolution, geo-IP, container metadata
4. Action
Actions transform or filter events:- RedactionPlugin: Removes or masks sensitive data (API keys, PII)
- Future: Sampling, alerting, custom transformations
5. Export
Processed events are sent to one or more destinations:| Exporter | Use Case |
|---|---|
| JSONL | File-based storage, offline analysis |
| WebSocket | Real-time streaming to Web UI |
| OTLP | OpenTelemetry-compatible backends (Grafana, Datadog, Honeycomb) |
| Kafka | High-throughput event streaming |
| Webhook | Custom HTTP endpoints |
Crate Structure
The Rust codebase is organized into focused crates:Event Flow
All events follow the OISP v0.1 specification. See OISP Spec for the full schema.
- Raw capture: eBPF captures bytes from SSL/process/file/network
- Ring buffer: Events are sent to userspace via eBPF ring buffers
- Decoding: Raw bytes → structured
RawCaptureEvent - OISP conversion:
RawCaptureEvent→OispEvent - Enrichment: Host, process tree, and other metadata added
- Redaction: Sensitive data removed based on configuration
- Trace building: Events grouped into agent traces
- Export: Events sent to configured destinations
- Broadcast: Events sent to Web UI via WebSocket
Concurrency Model
OISP Sensor uses Tokio for async I/O:- eBPF polling task: Reads from ring buffers every 10ms
- Pipeline task: Processes events through decode → enrich → action → export
- WebSocket task: Broadcasts events to connected clients
- HTTP server task: Serves Web UI and REST API
Memory Management
- Ring buffer size: 256 KB per event type (configurable)
- Event buffer: Last 10,000 events kept in memory for Web UI
- Trace builder: Automatic cleanup of stale traces (5 minute TTL)
- Socket cache: LRU with 10,000 entry limit for SSL correlation
Next Steps
- eBPF Capture - Deep dive into kernel-space capture
- Pipeline Architecture - Event processing details
- Event Schema - OISP event format