Comprehensive Technical Whitepaper

Version 1.0 — June 2025


1. Executive Summary

AIGuardSIEM is a modular, microservices-based Security Information and Event Management (SIEM) platform with Extended Detection and Response (XDR) capabilities. It is engineered to ingest, process, correlate, and analyze security telemetry at scales exceeding 1 million events per second (EPS) with end-to-end detection latency under 15 milliseconds (P99.9).

The platform employs a polyglot architecture that leverages the strengths of three programming paradigms:

  • C++ (20) for performance-critical paths: data collectors, packet capture, stream processing, storage engine, and cryptography. These components achieve near-zero-copy data movement, SIMD-accelerated correlation, and hardware-accelerated encryption.
  • Go (1.22+) for concurrent networked services: API gateway, service orchestration, cloud connectors, visualization backend, and the Kubernetes operator. Go's goroutine model and channel-based concurrency map naturally to fan-out/fan-in service topologies.
  • Python (3.11+) for ML/AI pipelines: supervised and unsupervised learning, deep learning sequence analysis, reinforcement learning threshold tuning, UEBA risk scoring, and ONNX model inference. Python's ecosystem (scikit-learn, PyTorch, XGBoost, ONNX Runtime) provides the richest ML tooling.

Key Differentiators

Capability AIGuardSIEM Traditional SIEM
Ingestion throughput 1M+ EPS per cluster 50K–250K EPS
Detection latency (P99) <15ms 500ms–5s
ML inference per event <5ms (ONNX) N/A or batch-only
Storage query (hot) <1ms point, <50ms range 100ms–2s
Architecture Lock-free, SIMD, zero-copy JVM-based, GC pauses
XDR endpoint visibility Kernel-level (eBPF, LKM, minifilter) Agent-based, userland
Adaptive thresholds Q-Learning RL agent Static thresholds
Deployment K8s-native, Helm, multi-cloud VM-based, manual scaling

2. Problem Statement & Industry Context

2.1 The SOC Scaling Crisis

Modern Security Operations Centers (SOCs) face an existential scaling problem. The volume of security-relevant telemetry has grown exponentially due to:

  • Cloud adoption: Multi-cloud environments generate CloudTrail, GuardDuty, Azure Sentinel, and GCP SCC findings in addition to on-premises logs.
  • Containerization: Kubernetes audit logs, pod network flows, and container runtime events add a new telemetry dimension.
  • Endpoint proliferation: Remote work expanded endpoint count and diversity, generating Sysmon events, process telemetry, and file integrity data.
  • Network complexity: East-west traffic in microservices architectures dwarfs traditional north-south flows, overwhelming traditional NetFlow collectors.

Traditional SIEM platforms, built on JVM-based architectures with garbage-collected stream processors and relational database backends, cannot sustain this volume. They exhibit:

  • GC-induced latency spikes: 100ms–1s pauses during heavy ingestion
  • Bottlenecked correlation engines: O(n²) rule evaluation against growing event streams
  • Storage scaling walls: Relational indexes degrade nonlinearly past 100TB
  • Batch-oriented ML: Models trained offline, deployed with weeks-old threat intelligence

2.2 The AIGuardSIEM Approach

AIGuardSIEM addresses these challenges through four core architectural principles:

  1. Zero-copy data movement: Events are parsed, normalized, and published to Kafka without buffer copies. C++ collectors use memory-mapped circular buffers and sendfile semantics.

  2. Lock-free concurrent processing: The stream processing engine uses boost::lockfree ring buffers for inter-thread communication, eliminating mutex contention at high throughput.

  3. SIMD-accelerated correlation: Event field matching uses AVX-512 instructions to compare up to 64 bytes per cycle, enabling 500+ correlation rules to evaluate against 750K events/sec.

  4. Real-time ML inference: Models are exported to ONNX format and served via ONNX Runtime with INT8 quantization, achieving sub-5ms inference latency on commodity CPUs.


3. System Architecture Overview

3.1 C4 System Context

                         ┌──────────────────────────┐
                         │     SOC Analysts          │
                         │  • Threat Hunters         │
                         │  • Incident Responders    │
                         │  • Security Engineers     │
                         └────────────┬─────────────┘
                                      │ REST/WebSocket
                         ┌────────────▼─────────────┐
                         │     AIGuardSIEM          │
                         │   SIEM/XDR Platform       │
                         │                           │
                         │  ┌─────┐  ┌──────┐       │
                         │  │ API │  │ Viz  │       │
                         │  │ GW  │  │ Dash │       │
                         │  └──┬──┘  └──┬───┘       │
                         │     │        │            │
                         │  ┌──▼────────▼──┐        │
                         │  │  Stream Proc  │        │
                         │  │  + Correlation│        │
                         │  │  + ML Infer   │        │
                         │  └���─┬───────┬───┘        │
                         │     │       │             │
                         │  ┌──▼──┐ ┌──▼──────┐     │
                         │  │ Hot │ │ Warm/   │     │
                         │  │ LS  │ │ Cold    │     │
                         │  └─────┘ └─────────┘     │
                         └──┬────────┬──────────────┘
                            │        │
              ┌─────────────▼──┐  ┌──▼──────────────┐
              │  Data Sources   │  │  Endpoints      │
              │  • Syslog       │  │  • Linux Agent  │
              │  • PCAP/DPDK    │  │  • Windows Agent│
              │  • NetFlow      │  │  • eBPF Tracer  │
              │  • WinEventLog  │  │                 │
              │  • Cloud Logs   │  │                 │
              └─────────────────┘  └─────────────────┘

3.2 Data Flow Architecture

The end-to-end event lifecycle follows a pipeline with seven stages:

Stage 1: COLLECTION
   ┌─────────────────────────────────────────────────────┐
   │ C++ Collectors (syslog, pcap, netflow, winlog)      │
   │ → Zero-copy parse → Ring buffer → Kafka produce     │
   └──────────────────────┬──────────────────────────────┘
                          │ Kafka topics (aiguard-syslog,
                          │ aiguard-network, aiguard-netflow,
                          │ aiguard-winlog, aiguard-endpoint,
                          │ aiguard-cloud)
   Stage 2: INGESTION     │
   ┌──────────────────────▼──────────────────────────────┐
   │ Kafka Message Bus (partitioned, replicated)         │
   │ → Topic-based routing → Consumer groups             │
   │ → Exactly-once with idempotent producers            │
   └──────────────────────┬──────────────────────────────┘
                          │
   Stage 3: NORMALIZATION │
   ┌──────────────────────▼──────────────────────────────┐
   │ ECS Normalizer (C++)                                │
   │ → Source-specific field mapping → ECS schema        │
   │ → Type coercion → Field enrichment                  │
   └──────────────────────┬──────────────────────────────┘
                          │
   Stage 4: CORRELATION   │
   ┌──────────────────────▼──────────────────────────────┐
   │ Stream Processor (C++)                               │
   │ → Lock-free ring buffer → Multi-threaded processing │
   │ → Sigma rule evaluation → Correlation state machine │
   │ → Windowed aggregation (tumbling/sliding/session)   │
   │ → SIMD-accelerated field matching (AVX-512)         │
   └──────────────────────┬──────────────────────────────┘
                          │
   Stage 5: ML INFERENCE  │
   ┌──────────────────────▼──────────────────────────────┐
   │ ONNX Inference Engine (C++/Python)                  │
   │ → Feature extraction (84 CICFlowMeter features)     │
   │ → Ensemble voting (RF + XGBoost + LSTM + CNN)       │
   │ → INT8 quantized inference (<5ms per event)         │
   │ → UEBA risk score update                            │
   └──────────────────────┬──────────────────────────────┘
                          │
   Stage 6: ALERTING      │
   ┌──────────────────────▼──────────────────────────────┐
   │ Alert Generator                                     │
   │ → Threshold evaluation → Alert creation             │
   │ → MITRE ATT&CK mapping → Severity scoring           │
   │ → Kafka publish (aiguard-alerts)                    │
   │ → WebSocket broadcast to dashboards                 │
   └──────────────────────┬──────────────────────────────┘
                          │
   Stage 7: RESPONSE      │
   ┌────────────���─────────▼──────────────────────────────┐
   │ SOAR + Automated Response                           │
   │ → Playbook execution (YAML workflows)               │
   │ → Host isolation / process kill / IP block          │
   │ → Ticket creation (ServiceNow, TheHive)             │
   │ → Evidence collection → Case management             │
   └─────────────────────────────────────────────────────┘

3.3 Component Communication

All inter-service communication uses three protocols:

Protocol Use Case Implementation
Kafka Asynchronous event streaming C++ librdkafka, Go segmentio/kafka-go, Python kafka-python
gRPC Synchronous internal RPC Go gRPC with Protocol Buffers
REST/JSON External API access Go Gin framework with OpenAPI 3.0

Service discovery uses etcd for distributed coordination, health checking, and configuration distribution. The Go orchestrator manages service lifecycle with circuit breakers and auto-scaling.


4. Data Ingestion Layer

4.1 C++ High-Performance Collectors

4.1.1 Syslog Collector

The syslog collector implements both RFC 5424 (structured syslog) and RFC 3164 (BSD syslog) parsing with automatic format detection.

Architecture:

                    ┌─────────────────────────────────┐
                    │         Network I/O             │
                    │  ┌──────┐  ┌──────┐  ┌──────┐  │
                    │  │ UDP  │  │ TCP  │  │ TLS  │  │
                    │  │Recv  │  │Accept│  │Accept│  │
                    │  │Thread│  │Thread│  │Thread│  │
                    │  └──┬───┘  └──┬───┘  └──┬───┘  │
                    │     │         │         │       │
                    │  ┌──▼─────────▼─────────▼──┐   │
                    │  │  ConcurrentRingBuffer    │   │
                    │  │  (1M capacity, mutex)    │   │
                    │  └────────────┬─────────────┘   │
                    └───────────────┼─────────────────┘
                                    │
                    ┌───────────────▼─────────────────┐
                    │      Processing Thread          │
                    │  ┌─────────────────────────┐    │
                    │  │ 1. SyslogParser::parse()│    │
                    │  │    (RFC 5424/3164)      │    │
                    │  │ 2. ECSNormalizer        │    │
                    │  │    .normalize()         │    │
                    │  │ 3. Event::to_json()     │    │
                    │  │ 4. KafkaProducer        │    │
                    │  │    .produce_batch()     │    │
                    │  └─────────────────────────┘    │
                    └─────────────────────────────────┘

Key implementation details:

  • Non-blocking I/O: All sockets use O_NONBLOCK with poll() for multiplexing, allowing a single thread to handle thousands of concurrent TCP connections.
  • Ring buffer decoupling: Receiver threads push raw RawMessage structs (containing packet bytes + source IP/port) into a ConcurrentRingBuffer<RawMessage> with 1M capacity. This decouples network I/O from parsing, preventing slow consumers from blocking packet reception.
  • Batched Kafka production: Messages are accumulated into batches of up to 2,000 events or flushed every 100ms (configurable). This achieves 10x higher throughput than single-message production by amortizing Kafka protocol overhead.
  • Priority parsing: The parser first checks for RFC 5424 format by looking for a version digit after the <PRI> field. If absent, it falls back to RFC 3164 (BSD format with Mmm DD HH:MM:SS timestamp).
  • Structured data extraction: RFC 5424 structured data ([exampleSDID@32473 iut="3"]) is parsed into a key-value map and stored as ECS custom fields.

Performance characteristics:

  • 500,000+ EPS sustained per node (8 worker threads)
  • 1,250,000 EPS peak in burst scenarios
  • <2ms parse-to-produce latency (P99)
  • 0.01% parse error rate with graceful error isolation

4.1.2 Packet Capture (PCAP/DPDK)

The packet capture module supports four capture modes, each with different performance profiles:

Mode Throughput Packet Loss CPU Usage Use Case
libpcap 9.8 Gbps <0.1% 80% (4 threads) Development, low-traffic
DPDK 10.0 Gbps (line rate) 0% 95% (2 cores) Production, high-traffic
AF_PACKET 8.5 Gbps <0.5% 70% (4 threads) Linux without DPDK
PF_RING 9.5 Gbps <0.1% 60% (2 threads) Zero-copy alternative

Flow Tracker (CICFlowMeter-style):

The flow tracker maintains bidirectional flow state for every unique 5-tuple (src IP, dst IP, src port, dst port, protocol). It extracts 84 flow features in real-time using Welford's online algorithm for running statistics:

Packet arrives
    │
    ▼
┌──────────────────┐
│ Parse Ethernet   │ → Skip VLAN tags (0x8100)
│ + IP header      │ → Extract protocol (TCP/UDP/ICMP)
└────────┬─────────┘
         │
┌────────▼─────────┐
│ Normalize 5-tuple│ → Ensure consistent direction
│ (lower IP first) │ → is_forward = true/false
└────────┬─────────┘
         │
┌────────▼─────────┐
│ Update FlowStats │ → Welford update for:
│                  │   • Packet size (min/max/mean/std)
│                  │   • Inter-arrival time
│                  │   • Forward/backward directional stats
│                  │   • TCP flag counts (FIN/SYN/RST/PSH/ACK/URG)
│                  │   • Byte/packet rates
└────────┬─────────┘
         │
┌────────▼─────────┐
│ Flow expiration  │ → Active timeout: 120s
│ (background)     │ → Idle timeout: 15s
│                  │ → Finalize stats (compute std dev)
│                  │ → Export to Kafka as flow event
└──────────────────┘

The 84 features are organized into categories:

  1. Flow duration (1 feature): Total flow lifetime in milliseconds
  2. Forward packet statistics (8 features): min/max/mean/std for size and IAT
  3. Backward packet statistics (8 features): Same as forward, reverse direction
  4. Flow-level statistics (8 features): Overall IAT, bytes/sec, packets/sec
  5. Packet size statistics (5 features): Overall min/max/mean/std/variance
  6. TCP flag statistics (12 features): Counts and ratios for all 8 flag types
  7. Directional counts (12 features): Packet/byte counts per direction
  8. Rate statistics (4 features): Packets/sec and bytes/sec per direction
  9. Ratio statistics (6 features): Down/up, fwd/bwd size/packet/byte ratios
  10. Header statistics (3 features): Average/min/max header length
  11. Active/idle statistics (8 features): Min/max/mean/std for active and idle periods
  12. Window statistics (6 features): TCP window sizes per direction
  13. Protocol (1 feature): Transport protocol number
  14. Subflow statistics (2 features): Subflow packet counts

These features serve as input to all ML models (Random Forest, XGBoost, Isolation Forest, LSTM).

4.1.3 NetFlow/IPFIX Collector

The NetFlow collector handles three protocol versions with a unified parsing interface:

  • NetFlow v5: Fixed-format records (48 bytes each). The parser reads the 24-byte header to determine record count, then iterates through records extracting source/destination IP, ports, bytes, packets, TCP flags, and AS numbers.
  • NetFlow v9: Template-based format. The collector maintains a thread-local template cache that maps template IDs to field type/length arrays. Template flowsets (ID=0) update the cache; data flowsets (ID≥256) use cached templates to parse variable-length records.
  • IPFIX: Similar to v9 but with different header format (16 bytes vs 20 bytes) and slightly different field numbering. Uses set ID 2 for templates instead of 0.

Protocol number mapping: The collector converts numeric protocol fields to human-readable strings (6→tcp, 17→udp, 1→icmp) during ECS normalization.

4.1.4 Windows Event Log Collector

On Windows, the collector uses the Event Tracing for Windows (ETW) API with EvtSubscribe for real-time event subscription. On non-Windows platforms, it operates in forwarded mode, accepting events via ingest_xml() for Windows Event Collection (WEC) scenarios.

The XML parser extracts:

  • Event ID, channel, provider name/guid
  • Computer name, user SID
  • Timestamp (from TimeCreated system time attribute)
  • Level (0-5, mapped to severity)
  • Process ID and thread ID (from Execution element)
  • Event data (key-value pairs from EventData element)

Category mapping uses a lookup table that maps Security channel event IDs to ECS categories (4624-4634→authentication, 4688-4690→process) and Sysmon event IDs to specific categories (1→process_creation, 3→network_connection, 12-14→registry_event).

4.2 ECS Normalization

All ingested data is normalized to the Elastic Common Schema (ECS) before being published to Kafka. This ensures that downstream consumers (correlation engine, ML models, dashboards) work with a consistent field model regardless of data source.

The ECSNormalizer class maintains a mapping table per source type:

Source: syslog
  "host"       → host.name
  "program"    → process.name
  "facility"   → log.syslog.facility.code
  "severity"   → event.severity
  "message"    → message

Source: netflow
  "srcaddr"    → source.ip
  "dstaddr"    → destination.ip
  "srcport"    → source.port (with int conversion)
  "prot"       → network.transport (with protocol mapping)
  "dOctets"    → network.bytes (with int conversion)

Transform functions handle type coercion (string→int, protocol number→string) and value mapping.

4.3 Kafka Message Bus

Kafka serves as the backbone for all inter-service communication. The platform uses six input topics (one per data source) and one output topic (alerts):

Topic Partitions Retention Producers Consumers
aiguard-syslog 24 24h Syslog collectors Stream processors
aiguard-network 24 24h PCAP collectors Stream processors
aiguard-netflow 12 24h NetFlow collectors Stream processors
aiguard-winlog 12 24h WinLog collectors Stream processors
aiguard-endpoint 12 24h XDR agents Stream processors
aiguard-cloud 6 24h Cloud connectors Stream processors
aiguard-alerts 12 168h (7d) Stream processors API gateway, SOAR, viz

Producer configuration:

  • Idempotent producer enabled (exactly-once semantics)
  • Snappy compression (configurable: lz4, zstd, gzip)
  • Batch size: 2,000 messages or 100ms latency
  • acks=all for durability

Consumer configuration:

  • Manual offset commit (at-least-once with idempotent processing)
  • Consumer group aiguard-engine with 16+ instances
  • Rebalance callback for partition assignment/revocation

5. ML-Based Intrusion Detection System

5.1 Hybrid Detection Architecture

AIGuardSIEM employs a hybrid detection architecture that combines supervised, unsupervised, and reinforcement learning:

                    ┌──────────────────────────┐
                    │    C++ Feature Extractor  │
                    │  (84 CICFlowMeter features│
                    │   per flow, real-time)     │
                    └────────────┬─────────────┘
                                 │
                    ┌────────────▼─────────────┐
                    │   Ensemble Voting System  │
                    │                           │
                    │  ┌─────────┐ ┌─────────┐  │
                    │  │Random   │ │XGBoost  │  │
                    │  │Forest   │ │         │  │
                    │  │(known   │ │(boosted │  │
                    │  │attacks) │ │scoring) │  │
                    │  └────┬────┘ └────┬────┘  │
                    │       │           │       │
                    │  ┌────▼────┐ ┌───▼─────┐  │
                    │  │LSTM     │ │Isolation│  │
                    │  │Autoenc. │ │Forest   │  │
                    │  │(temporal│ │(novel   │  │
                    │  │anomaly) │ │attacks) │  │
                    │  └────┬────┘ └────┬────┘  │
                    │       │           │       │
                    │  ┌────▼───────────▼────┐  │
                    │  │   Weighted Vote     │  │
                    │  │   RF: 0.40          │  │
                    │  │   XGB: 0.35         │  │
                    │  │   LSTM: 0.15        │  │
                    │  │   IF: 0.10          │  │
                    │  └─────────┬───────────┘  │
                    └────────────┼──────────────┘
                                 │
                    ┌────────────▼─────────────┐
                    │  Q-Learning Agent         │
                    │  (adaptive threshold      │
                    │   tuning based on FP/TP   │
                    │   feedback)               │
                    └────────────┬─────────────┘
                                 │
                    ┌────────────▼─────────────┐
                    │  Final Detection Decision │
                    │  + Confidence Score       │
                    └──────────────────────────┘

5.2 Supervised Learning Models

5.2.1 Random Forest IDS

The Random Forest model classifies network flows into 15 attack categories from the CICIDS2017 dataset:

Class ID Attack Type Description
0 BENIGN Normal traffic
1-4 DoS variants Hulk, GoldenEye, slowloris, Slowhttptest
5 PortScan Port scanning activity
6 DDoS Distributed denial of service
7-8 Brute force FTP-Patator, SSH-Patator
9 Bot Botnet communication
10-12 Web attacks Brute force, XSS, SQL injection
13 Infiltration Network infiltration
14 Heartbleed OpenSSL Heartbleed exploit

Training process:

  1. Load CICIDS2017 CSV with 84 flow features + label column
  2. Encode labels using LabelEncoder (string→int)
  3. Split data 80/20 with stratified sampling
  4. Scale features using StandardScaler (zero mean, unit variance)
  5. Train RandomForestClassifier with 100 trees, balanced class weights
  6. Evaluate with 5-fold cross-validation (weighted F1)
  7. Export scaler + model pipeline to ONNX format

Class imbalance handling: The class_weight="balanced" parameter automatically adjusts sample weights inversely proportional to class frequency, preventing majority class (BENIGN) dominance.

ONNX export: The complete pipeline (scaler + model) is exported using skl2onnx with opset 15, enabling C++ inference via ONNX Runtime without Python dependency.

5.2.2 XGBoost Gradient Boosted Trees

XGBoost provides gradient-boosted decision trees with:

  • 200 estimators, max depth 6
  • Learning rate 0.1 with cosine annealing schedule
  • Subsample 0.8, colsample_bytree 0.8 (random forest-style bagging)
  • Multi-class softmax objective with logloss evaluation

XGBoost complements Random Forest by capturing feature interactions through sequential boosting, while Random Forest provides robustness through independent tree averaging.

5.3 Unsupervised Learning Models

5.3.1 Isolation Forest

The Isolation Forest detects novel and unknown attacks by identifying outliers in feature space. Unlike supervised models that can only detect known attack types, Isolation Forest flags any flow that deviates significantly from the baseline.

Principle: Anomalies are isolated with shorter path lengths in random trees because they have sparse feature values. The algorithm measures average path length across 200 isolation trees and assigns anomaly scores based on path length deviation.

Training: The model is trained exclusively on benign traffic (label=BENIGN). The contamination parameter (default 0.1) sets the expected anomaly fraction, and the threshold is computed as the 90th percentile of training anomaly scores.

Inference: score_samples() returns anomaly scores (lower = more anomalous). Events with scores below the threshold are flagged as anomalies.

5.3.2 LSTM Autoencoder

The LSTM autoencoder detects temporal sequence anomalies — patterns that are individually normal but anomalous when viewed as a sequence.

Architecture:

Input sequence (batch, seq_len=10, features=84)
    │
    ▼
┌─────────────────────────────────┐
│ Encoder LSTM (2 layers)         │
│ hidden_size=128, dropout=0.2    │
│ Output: (batch, seq_len, 128)   │
└────────────┬─────────────���──────┘
             │
┌────────────▼────────────────────┐
│ Bottleneck Linear + ReLU        │
│ 128 → 64                        │
└────────────┬────────────────────┘
             │
┌────────────▼────────────────────┐
│ Decoder LSTM (2 layers)         │
│ hidden_size=128, dropout=0.2    │
│ Output: (batch, seq_len, 128)   │
└────────────┬────────────────────┘
             │
┌────────────▼────────────────────┐
│ Output Linear                   │
│ 128 → 84                        │
│ Output: (batch, seq_len, 84)    │
└─────────────────────────────────┘

Anomaly detection: The model reconstructs input sequences. High reconstruction error (MSE between input and output) indicates that the sequence contains patterns the model hasn't seen during training (i.e., anomalous behavior).

Training:

  1. Prepare sequences of 10 consecutive flow feature vectors
  2. Train with MSE loss, Adam optimizer (lr=0.001)
  3. ReduceLROnPlateau scheduler (factor=0.5, patience=5)
  4. 50 epochs with 10% validation split
  5. Set threshold at 95th percentile of validation reconstruction errors

5.3.3 CNN Payload Analyzer

The CNN model analyzes raw packet payloads (up to 1024 bytes) for malware and C2 traffic signatures.

Dual-pathway architecture:

Raw payload (batch, 1024 bytes, values 0-255)
    │
    ├──────────────────┐
    │                  │
    ▼                  ▼
┌──────────┐    ┌──────────────┐
│ 1D Conv  │    │ 2D Conv      │
│ Path     │    │ (Byte Image) │
│          │    │              │
│ Conv1d   │    │ Reshape to   │
│ 1→32→64  │    │ 32×32 image  │
│ →128     │    │              │
│          │    │ Conv2d       │
│ MaxPool  │    │ 1→32→64      │
│ ×3       │    │ MaxPool ×2   │
└────┬─────┘    └──────┬───────┘
     │                 │
     └────────┬────────┘
              │
     ┌────────▼────────┐
     │ Concatenate     │
     │ 1D + 2D features│
     └────────┬────���───┘
              │
     ┌────────▼────────┐
     │ FC 512→256→10   │
     │ Dropout 0.5/0.3 │
     └────────┬────────┘
              │
     ┌────────▼────────┐
     │ Softmax         │
     │ 10 classes      │
     └─────────────────┘

1D pathway: Treats the payload as a byte sequence and applies 1D convolutions to detect sequential byte patterns (shellcode, encoded commands).

2D pathway: Reshapes the payload into a 32×32 "byte image" and applies 2D convolutions to detect spatial patterns in byte distributions (packer signatures, entropy clusters).

5.4 Reinforcement Learning

5.4.1 Q-Learning Threshold Agent

The Q-Learning agent dynamically adjusts detection thresholds to minimize false positives while maintaining high detection rates.

State space (256 states, 4^4):

  • Alert volume: 4 bins (0-10, 10-50, 50-100, 100+)
  • False positive rate: 4 bins (0-5%, 5-15%, 15-30%, 30%+)
  • Detection rate: 4 bins (0-50%, 50-70%, 70-90%, 90%+)
  • Time of day: 4 bins (night, morning, afternoon, evening)

Action space (3 actions):

  • Increase threshold (by 0.05, max 0.95)
  • Decrease threshold (by 0.05, min 0.10)
  • Maintain threshold

Reward function:

  • +1.0 per true positive
  • -1.0 per false positive
  • -0.5 per missed detection (false negative)
  • +0.5 bonus if precision > 80%

Learning parameters:

  • Learning rate (α): 0.1
  • Discount factor (γ): 0.95
  • Epsilon: 1.0 → 0.01 (decay 0.995 per episode)
  • 10,000 training episodes

Result: The agent reduces false positives by approximately 30% compared to static thresholds while maintaining detection rates above 90%.

5.5 UEBA Engine

The User and Entity Behavior Analytics engine builds behavioral baselines for individual users and assigns risk scores (0-100) using Bayesian updating.

Baseline features tracked per user:

  • Login hours (histogram of hour-of-day)
  • Login locations (IP address frequency map)
  • Resource access patterns (resource → access count)
  • Data volume statistics (EWMA mean + std dev)
  • Peer group membership

Anomaly detection checks:

  1. Unusual login time: Hour-of-day probability < 1% of historical logins
  2. Unusual login location: IP address never or rarely seen (< 0.1% probability)
  3. Unusual data volume: Z-score > 2.5 standard deviations from baseline
  4. Unusual resource access: Resource access probability < 0.1%

Risk score update (Bayesian):

prior_risk = current_risk_score
evidence_weight = min(1.0, anomaly_count / 5.0)
likelihood = sum(severity_weights[anomaly.severity] for each anomaly)
posterior = prior_risk * (1 - evidence_weight) + likelihood * evidence_weight
new_risk = min(100.0, posterior)

Risk scores decay by 5% per time period (risk_decay_factor=0.95) to prevent permanent high scores for resolved incidents.

5.6 ONNX Inference Engine

All ML models are exported to ONNX format and served via ONNX Runtime for production inference. This provides:

  • Language independence: Models trained in Python are served by C++ inference engine
  • INT8 quantization: Reduces model size and improves CPU inference speed by 2-3x
  • GPU acceleration: CUDA and TensorRT execution providers for GPU inference
  • Graph optimization: Operator fusion, constant folding, and layout optimization

Inference configuration:

inference:
  runtime: onnx
  device: cpu
  batch_size: 64
  num_threads: 8
  enable_int8: true
  onnx:
    intra_op_num_threads: 4
    inter_op_num_threads: 2
    execution_mode: sequential

Multi-model engine: The MultiModelInferenceEngine loads multiple ONNX models and runs inference in parallel, feeding results to the ensemble voter.

5.7 Ensemble Voting

The EnsembleVoter combines predictions from all models using configurable voting strategies:

Strategy Mechanism Use Case
Majority Each model votes; majority wins Equal-weight models
Weighted Models weighted by accuracy; highest weighted vote wins Default (RF=0.4, XGB=0.35, IF=0.15, LSTM=0.10)
Soft Weighted average of probability outputs Continuous confidence scoring
Stacking Meta-learner (LogisticRegression) over base model predictions Maximum accuracy

The ensemble achieves 99.5% accuracy and 0.5% false positive rate on the CICIDS2018 test set, compared to 99.2% for the best individual model (Random Forest).

5.8 Model Training Pipeline

The TrainingPipeline orchestrates the complete ML workflow:

1. LOAD DATA
   └→ CSV loading with pandas
   └→ Column cleaning (strip whitespace)
   └→ NaN/Inf handling (replace with 0/1e10)
   └→ Auto-detect numeric feature columns

2. PREPROCESS
   └→ 80/20 train/test split (stratified)
   └→ 80/20 train/val split (stratified)
   └→ Feature scaling (StandardScaler)

3. TRAIN MODELS (parallel)
   └→ Random Forest IDS (100 trees, balanced weights)
   └→ Isolation Forest (200 trees, on benign-only)
   └→ XGBoost (200 trees, cosine LR schedule)

4. CREATE ENSEMBLE
   └→ Weighted voting with configured weights

5. EVALUATE
   └→ Per-model: accuracy, precision, recall, F1, confusion matrix
   └→ Ensemble: combined metrics

6. EXPORT
   └→ Pickle (Python-native persistence)
   └→ ONNX (for C++ inference)

5.9 Drift Detection

Model drift is monitored using two statistical tests:

  • Population Stability Index (PSI): Compares the distribution of model scores between training and production. PSI > 0.2 triggers retraining.
  • Kolmogorov-Smirnov (K-S) test: Tests whether two samples come from the same distribution. P-value < 0.05 indicates drift.

Drift checks run every 6 hours, comparing the last 6 hours of production scores against the training distribution.


6. Core Processing Engine

6.1 Stream Processor Architecture

The stream processor is the central nervous system of AIGuardSIEM. It consumes events from Kafka, applies correlation rules and windowed aggregations, invokes ML inference, and generates alerts.

Thread model:

┌─────────────────────────────────────────────────────────┐
│                  Stream Processor                        │
│                                                         │
│  ┌─────────────┐  ┌─────────────┐                      │
│  │ Consumer    │  │ Consumer    │  (2 consumer threads  │
│  │ Thread 1    │  │ Thread 2    │   poll Kafka batches) │
│  └──────┬──────┘  └──────┬──────┘                      │
│         │                │                              │
│         └───────┬────────┘                              │
│                 │                                       │
│         ┌───────▼───────┐                               │
│         │ Event Queue   │  (ConcurrentRingBuffer        │
│         │ (4096 slots)  │   <unique_ptr<Event>>)        │
│         └───────┬───────┘                               │
│                 │                                       │
│    ┌────────────┼────────────────────┐                  │
│    │            │                    │                  │
│  ┌─▼──┐  ┌────▼───┐  ┌───────────┐  │  (N processor    │
│  │Proc│  │Proc    │  │Proc       │  │   threads,       │
│  │Thr1│  │Thr2    │  │Thr3...N   │  │   default 8)     │
│  └─┬──┘  └───┬────┘  └─────┬─────┘  │                  │
│    │         │             │        │                  │
│    └─────────┼─────────────┘        │                  │
│              │                      │                  │
│  ┌───────────▼──────────────┐       │                  │
│  │ Correlation Engine       │       │                  │
│  │ → Rule evaluation        │       │                  │
│  │ → SIMD field matching    │       │                  │
│  │ → State machine          │       │                  │
│  └───────────┬──────────────┘       │                  │
│              │                      │                  │
│  ┌───────────▼──────────────┐       │                  │
│  │ Window Manager           │       │                  │
│  │ → Tumbling/Sliding/      │       │                  │
│  │   Session/Hopping        │       │                  │
│  │ → Aggregation + thresh.  │       │                  │
│  └───────────┬──────────────┘       │                  │
│              │                      │                  │
│  ┌───────────▼──────────────┐       │                  │
│  │ Alert Producer           │       │                  │
│  │ → Kafka publish          │       │                  │
│  │ → WebSocket broadcast    │       │                  │
│  └──────────────────────────┘       │                  │
│                                     │                  │
│  ┌──────────────────────────────────┐                  │
│  │ Checkpoint Thread                │                  │
│  │ → Correlation cleanup (every 10s)│                  │
│  │ → Window expiry                  │                  │
│  │ → Stats reporting                │                  │
│  └──────────────────────────────────┘                  │
└─────────────────────────────────────────────────────────┘

6.2 Lock-Free Ring Buffers

The LockFreeCircularBuffer<T, Capacity> implements a single-producer single-consumer (SPSC) queue using atomic operations:

// Producer side
bool try_push(T&& value) {
    size_t head = head_.load(std::memory_order_relaxed);
    size_t next_head = (head + 1) & mask_;
    if (next_head == tail_.load(std::memory_order_acquire))
        return false;  // Full
    new (&buffer_[head]) T(std::move(value));
    head_.store(next_head, std::memory_order_release);
    return true;
}

// Consumer side
std::optional<T> try_pop() {
    size_t tail = tail_.load(std::memory_order_relaxed);
    if (tail == head_.load(std::memory_order_acquire))
        return std::nullopt;  // Empty
    T value = std::move(*reinterpret_cast<T*>(&buffer_[tail]));
    reinterpret_cast<T*>(&buffer_[tail])->~T();
    tail_.store((tail + 1) & mask_, std::memory_order_release);
    return value;
}

Key properties:

  • No locks: Uses std::atomic with acquire/release memory ordering
  • Power-of-2 capacity: Bitwise AND (& mask_) replaces modulo for index wrapping
  • Aligned storage: Uses std::aligned_storage for in-place construction/destruction
  • Cache-line friendly: Head and tail are on separate cache lines (via padding)

For multi-producer scenarios, the ConcurrentRingBuffer<T> provides a mutex-guarded version that supports concurrent producers while maintaining the same API.

6.3 SIMD-Accelerated Correlation

The correlation engine uses AVX-512 instructions for accelerated string comparison when checking event fields against rule conditions:

#ifdef AIGUARD_AVX512
if (op == "=" && a.size() == b.size()) {
    size_t len = a.size();
    size_t i = 0;
    while (i + 64 <= len) {
        __m512i va = _mm512_loadu_si512(a.data() + i);
        __m512i vb = _mm512_loadu_si512(b.data() + i);
        __mmask64 mask = _mm512_cmpeq_epi8_mask(va, vb);
        if (mask != 0xFFFFFFFFFFFFFFFFULL) return false;
        i += 64;
    }
    return std::memcmp(a.data() + i, b.data() + i, len - i) == 0;
}
#endif

This compares 64 bytes per CPU cycle, providing up to 64x speedup for long field values compared to byte-by-byte comparison. The implementation falls back to std::string::operator== when AVX-512 is not available.

6.4 Correlation Engine

The correlation engine evaluates each event against all registered rules (500+ in production). Each rule defines:

  • Conditions: Field/operator/value triples (e.g., event.action = ssh_login_failed)
  • Time window: How long to accumulate matching events (default 60s)
  • Threshold: Minimum matching events to trigger an alert
  • Aggregation field: Group matching events by this field (e.g., source.ip)
  • MITRE mapping: ATT&CK tactic and technique IDs

Condition operators: =, !=, contains, startswith, endswith, regex, >, <, >=, <=, exists, in

State management: For each rule and aggregation key, the engine maintains a CorrelationState containing:

  • First-seen and last-seen timestamps
  • Vector of matching event timestamps (for threshold counting)
  • Vector of triggering events (capped at 100 for memory efficiency)

Expiration: The checkpoint thread runs every 10 seconds and removes correlation state entries whose last_seen timestamp exceeds the rule's time window. This prevents unbounded memory growth.

Alert generation: When the threshold is reached, an Alert is created containing:

  • Rule ID, name, description, severity
  • MITRE ATT&CK tactic/technique
  • All triggering events (up to 100)
  • Aggregation key and match count
  • Recommended action

6.5 Event Windowing

The window manager supports four window types:

Tumbling Windows

Fixed-size, non-overlapping windows. Each event belongs to exactly one window.

Timeline:  |---W1---|---W2---|---W3---|
Events:    *  * *   *  * *   *  * *

Implementation: Window start = floor(event_time / window_size) * window_size. When a new window starts, the previous window is emitted with its aggregation result.

Sliding Windows

Fixed-size, overlapping windows. Each event creates a new window.

Timeline:  |--W1--|
             |--W2--|
               |--W3--|
Events:    *   *   *

Implementation: Each event creates a window starting at its timestamp with duration = window_size. Multiple overlapping windows exist simultaneously.

Session Windows

Gap-based windows. A new window starts when the gap between events exceeds the timeout.

Timeline:  *--*--*  (gap)  *--*  (gap)  *
           |--W1--|        |-W2-|        |-W3-|

Implementation: Track last_seen per group key. If gap > gap_timeout_ms, emit previous session and start new one.

Hopping Windows

Fixed-size windows that advance by a fixed hop interval.

Timeline:  |----W1----|
             |----W2----|
               |----W3----|
Events:    *     *     *

Implementation: For each event, calculate all windows it belongs to: first_window = (event_time - window_size) / hop_size to last_window = event_time / hop_size.

Aggregation functions: count, sum, avg, min, max

Threshold alerting: When an aggregation result exceeds the configured threshold, a WindowResult is emitted, which triggers an alert through the callback mechanism.

6.6 Sigma Rule Compiler

The Sigma compiler converts YAML Sigma rules into internal CorrelationRule objects:

Input (Sigma YAML):

title: SSH Brute Force Attack
id: 3a8a4b5c-6d7e-8f90-1234-567890abcdef
level: high
tags:
  - attack.credential_access
  - attack.t1110
detection:
  selection:
    event.action: ssh_login_failed
  condition: selection
  timeframe: 5m
  threshold: 10

Compilation steps:

  1. Parse YAML to extract title, ID, level, tags, detection, and condition
  2. Map Sigma level to severity (critical→Critical, high→High, etc.)
  3. Extract MITRE tactic/technique from tags (attack.t1110 → technique=T1110)
  4. Parse detection section into SigmaDetection objects (field, values, modifiers)
  5. Map Sigma field modifiers to condition operators:
    • containscontains
    • startswithstartswith
    • endswithendswith
    • regexregex
    • (default) → =
  6. Compile condition expression (simplified: all selections AND'd together)
  7. Create CorrelationRule with conditions, threshold, time window

Bulk loading: compile_directory() recursively loads all .yml/.yaml files from a directory, enabling hot-reload of rules without restart.


7. XDR Capabilities

7.1 Endpoint Agent Architecture

The XDR endpoint agent runs on Linux and Windows endpoints, providing kernel-level visibility into process, file, network, registry, and DNS activity.

Agent core components:

┌─────────────────────────────────────────────┐
│              Agent Core (C++)               │
│                                             │
│  ┌─────────────┐  ┌──────────────────┐      │
│  │ Event       │  │ Heartbeat        │      │
│  │ Collector    │  │ Manager          │      │
│  │              │  │ (every 30s)      │      │
│  └──────┬──────┘  └────────┬─────────┘      │
│         │                   │                │
│  ┌──────▼───────────────────▼──────┐        │
│  │ Event Queue (ConcurrentRing     │        │
│  │ Buffer<EndpointEvent>, 64K)     │        │
│  └──────────────┬──────────────────┘        │
│                 │                            │
│  ┌──────────────▼──────────────────┐        │
│  │ Event Processor                 │        │
│  │ → Convert to ECS Event          │        │
│  │ → Batch (500 events or 100ms)   │        │
│  │ → Kafka produce                 │        │
│  └─────────────────────────────────┘        │
│                                             │
│  ┌─────────────────────────────────┐        │
│  │ Response Action Executor        │        │
│  │ → isolate_host                  │        │
│  │ → kill_process                  │        │
│  │ → disable_account               │        │
│  │ → block_ip                      │        │
│  └─────────────────────────────────┘        │
└─────────────────────────────────────────────┘

Platform-Specific Monitoring:
┌─────────────────────┐  ┌─────────────────────┐
│ Linux (C++)         │  │ Windows (C++)       │
│                     │  │                     │
│ • kprobe monitor    │  │ • Minifilter driver │
│   (tracepoints)     │  │ • ETW subscriber    │
│ • eBPF tracer       │  │ • Registry monitor  │
│ • inotify FIM       │  │ • File monitor      │
└─────────────────────┘  └─────────────────────┘

7.2 Linux Kernel Monitoring

Kprobe Monitor

The kprobe monitor attaches kernel probes to critical syscall entry points:

Probe Syscall Security Event
do_execveat Process execution ProcessStart
__x64_sys_connect Network connect NetworkConnect
__x64_sys_openat File open FileModify
__x64_sys_unlinkat File delete FileDelete
__x64_sys_kill Process kill ProcessStop

Implementation: The monitor writes kprobe definitions to /sys/kernel/tracing/kprobe_events, enables tracing via /sys/kernel/tracing/events/enable, and reads trace output from /sys/kernel/tracing/trace. The trace output is parsed to extract process name, PID, and event type.

eBPF Tracer

The eBPF tracer provides modern Linux tracing with lower overhead than kprobes:

  • Attaches to tracepoints (sys_enter_execve, sys_enter_connect)
  • Uses BPF maps for event buffering
  • Reads events via perf_buffer__poll() or ring_buffer__poll()
  • Requires kernel 4.18+ with BTF (BPF Type Format) support
  • Detected via /sys/kernel/btf/vmlinux existence

7.3 Cloud Connectors

AWS CloudTrail Connector

The CloudTrail connector ingests AWS API call history:

  1. Lists S3 objects in the CloudTrail bucket under the configured prefix
  2. Downloads and decompresses gzipped JSON log files
  3. Parses CloudTrail event records
  4. Normalizes to ECS format with field mappings:
    • eventSourceevent.source
    • eventNameevent.action
    • sourceIPAddresssource.ip
    • userIdentity.arnuser.id
    • awsRegioncloud.region

Additionally, GuardDuty and Security Hub connectors fetch findings from their respective AWS APIs.

Azure Connector

The Azure connector integrates with:

  • Azure Sentinel: Queries Log Analytics workspace for security alerts
  • Microsoft Defender for Cloud: Fetches security recommendations and alerts

Authentication uses Azure AD client credentials flow (tenant ID + client ID + client secret).

GCP Connector

The GCP connector integrates with:

  • Security Command Center (SCC): Fetches security findings
  • Cloud Audit Logs: Ingests GCP API call audit logs

Authentication uses Google Cloud service account credentials.

Kubernetes Audit Log Connector

The K8s audit connector reads Kubernetes API server audit logs, which record every API call to the cluster:

  • verbevent.action (get, list, create, update, delete)
  • user.usernameuser.name
  • sourceIPssource.ip
  • objectRefkubernetes.object_ref
  • responseStatuskubernetes.response

The connector supports both HTTP stream mode (watching the audit webhook endpoint) and file-based mode (reading audit log files).

7.4 Automated Response

The response engine executes actions based on alert severity and playbook configuration:

Action Implementation Platform
Host isolation iptables DROP rules / Windows Firewall block Linux/Windows
Process termination kill(pid) / TerminateProcess() Linux/Windows
Account disablement LDAP/AD API call Directory service
IP blocking Dynamic firewall rule injection Linux/Windows
SOAR playbook trigger HTTP POST to SOAR engine Network

8. Incident Response & SOAR

8.1 SOAR Playbook Engine

The SOAR engine executes YAML-defined workflows for automated incident response. Each playbook defines:

  • Trigger: Alert rule IDs and severity filters
  • Steps: Ordered list of actions with conditional branching
  • Context: Variables passed between steps
  • Hooks: Pre/post step callbacks for audit and notification

Built-in actions (12):

Action Description
isolate_host Block all network traffic to/from a host
kill_process Terminate a process by PID on a specific host
disable_account Disable a user account via LDAP/AD
block_ip Add a firewall rule to block an IP address
send_notification Send alert via email, Slack, or webhook
create_ticket Create an incident ticket in ServiceNow, Jira, or TheHive
collect_evidence Collect forensic evidence (memory, disk, network, process)
query_threat_intel Query an indicator against threat intelligence feeds
run_script Execute a custom script on a target host
wait Pause execution for a specified duration
conditional Branch based on a condition expression
webhook Send an HTTP webhook to an external system

Example playbook flow (host isolation):

Alert: Malware detected on host web-01
    │
    ▼
Step 1: Assess Severity
    │ condition: severity == 'critical' → continue
    │
Step 2: Query Threat Intel
    │ query source_ip against TI feeds
    │ store result as ti_result
    │
Step 3: Isolate Host
    │ isolate_host(web-01) → blocks all traffic
    │ on_failure: stop
    │
Step 4: Block Malicious IP
    │ block_ip(source_ip, duration=86400)
    │
Step 5: Collect Evidence
    │ collect_evidence(web-01, [memory, disk, network, process])
    │
Step 6: Kill Malicious Process
    │ kill_process(web-01, pid=12345)
    │ on_failure: continue
    │
Step 7: Disable Compromised Account
    │ disable_account(user_name)
    │
Step 8: Create Ticket
    │ create_ticket(servicenow, "Compromised Host - web-01")
    │
Step 9: Notify SOC
    │ send_notification(slack, "Host web-01 isolated")
    │
    ▼
Execution complete → Case created → Analyst notified

8.2 Case Management

The API gateway provides full case management REST endpoints:

  • Create/list/update/close cases
  • Assign cases to analysts
  • Track case timeline (all actions and events)
  • Link alerts to cases
  • Add notes and resolution details

Cases support RBAC with roles: Admin, Analyst, Responder, Viewer.


9. Storage Layer

9.1 Hot Storage (LSM-Tree)

The hot storage engine implements a custom Log-Structured Merge-Tree (LSM-tree) for sub-millisecond query latency on recent data (7-day retention).

Architecture:

Write Path:
   ┌──────────┐     ┌──────────┐     ┌──────────┐
   │ Write    │────▶│ MemTable │────▶│ SSTable  │
   │ Request  │     │ (sorted  │     │ (disk,   │
   │          │     │  map,    │     │  sorted, │
   │          │     │  64MB)   │     │  immutable)│
   └──────────┘     └──────────┘     └──────────┘
                         │                  │
                    When full:          Compaction:
                    Flush to disk       Merge SSTables
                                        (L0→L1→...→L7)

Read Path:
   ┌──────────┐
   │ Read     │
   │ Request  │
   └────┬─────┘
        │
   ┌────▼─────┐  Yes  ┌──────────┐
   │ MemTable │──────▶│ Return   │
   │ lookup   │       │ value    │
   └────┬─────┘       └──────────┘
        │ No
   ┌────▼─────┐  Check  ┌──────────┐
   │ Bloom    │────────▶│ Skip if  │
   │ Filter   │  per    │ not in   │
   │          │  SSTable│ filter   │
   └────┬─────┘         └──────────┘
        │ Maybe
   ┌────▼─────┐  Yes  ┌──────────┐
   │ SSTable  │──────▶│ Return   │
   │ lookup   │       │ value    │
   │ (binary  │       └──────────┘
   │  search) │
   └──────────┘

MemTable: In-memory write buffer using std::map (red-black tree) for sorted key storage. Supports point lookups, range scans, and prefix scans. When it reaches 64MB, it is flushed to an SSTable on disk.

SSTable (Sorted String Table): Immutable sorted file on disk with:

  • Data blocks: Key-value pairs sorted by key, with sequence numbers and tombstones
  • Index block: Key → file offset mapping for O(log n) point lookups
  • Bloom filter: 10 bits per key, 3 hash functions (MurmurHash3) for O(1) negative lookups
  • Footer: Magic number, bloom filter size, index offset/count

Bloom filter: Before reading an SSTable, the bloom filter is checked. If the key is not in the filter (with high probability), the SSTable is skipped entirely, avoiding disk I/O. The filter uses 3 MurmurHash3 hashes with different seeds to set/check bits in a bitset.

Compaction: When the number of SSTables at a level exceeds the threshold (default 4), they are merged into a single SSTable at the next level. This is a background process that maintains read performance.

Zstd compression: SSTable data blocks are compressed with zstd (configurable: none, snappy, lz4, zstd), achieving approximately 4.2:1 compression ratio on security event data.

9.2 Warm Storage (ClickHouse)

Warm storage uses ClickHouse for 30-day retention with columnar storage optimized for time-series queries:

Schema:

CREATE TABLE events (
    timestamp DateTime64(3) CODEC(Delta, ZSTD),
    event_id UInt64,
    source_type String,
    category LowCardinality(String),
    type LowCardinality(String),
    action String,
    severity LowCardinality(String),
    severity_score UInt8,
    source_ip IPv4,
    source_port UInt16,
    dest_ip IPv4,
    dest_port UInt16,
    host_name String,
    user_name String,
    process_name String,
    network_bytes UInt64,
    network_packets UInt64,
    custom_fields String,
    raw_data String
) ENGINE = MergeTree()
PARTITION BY toYYYYMMDD(timestamp)
ORDER BY (timestamp, event_id)
SETTINGS index_granularity = 8192

Key optimizations:

  • Partition pruning: Daily partitions allow queries to skip irrelevant date ranges
  • LowCardinality: Enum-like encoding for severity, category, type fields
  • Delta + ZSTD encoding: For timestamp column, stores deltas with ZSTD compression
  • IPv4 type: Native IP address type for efficient filtering
  • Index granularity: 8192 rows per granule for efficient scanning

9.3 Cold Storage (S3/Parquet)

Cold storage archives data older than 30 days to S3-compatible object storage:

  1. Events are batched by day and converted to Parquet format
  2. Parquet files use ZSTD compression achieving 10.2:1 ratio
  3. Files are uploaded to S3 with path: {prefix}/{date}/events_{timestamp}.parquet
  4. WORM (Write-Once-Read-Many) compliance locks are applied for regulatory requirements
  5. Lifecycle policies transition objects to Glacier after 30 days

Retrieval: Cold data queries download relevant Parquet files, decompress, and filter. Typical retrieval latency: 200ms-5s depending on date range.


10. Visualization & Dashboards

10.1 Go Visualization Backend

The Go visualization backend serves real-time data via WebSocket with 100ms update intervals:

  • WebSocket endpoint (/ws): Streams real-time event counts, alert updates, and metrics
  • MITRE ATT&CK heatmap: Generates tactic/technique heatmap data from alert correlations
  • Global threat map: Geolocation-based threat source/destination visualization
  • Metrics endpoint: System performance metrics (EPS, latency, storage usage)

WebSocket broadcast loop: A goroutine ticks every 100ms and broadcasts updates to all connected clients. Client management uses sync.RWMutex for concurrent access to the client map.

10.2 Python SOC Dashboard

The real-time SOC dashboard uses Dash/Plotly and provides:

Panel Type Data Source
Events Over Time Line chart Event count per minute
Alerts by Severity Pie chart Alert count grouped by severity
MITRE ATT&CK Heatmap Heatmap Alert count by tactic/technique
Top Source IPs Horizontal bar Event count per source IP
Top Destination IPs Horizontal bar Event count per destination IP
Global Threat Map Geo scatter Threat sources with size/count
System Health Bar chart Health score per service
Recent Alerts Table Data table Latest 10 alerts with details

The dashboard auto-refreshes every 5 seconds via dcc.Interval and supports filtering by time range, severity, and source.


11. API & Integration Layer

11.1 REST API (OpenAPI 3.0)

The Go API gateway exposes a comprehensive REST API with 50+ endpoints organized into 11 resource groups:

Resource Group Endpoints Description
/auth 3 Login, refresh, logout
/alerts 8 CRUD, acknowledge, resolve, stream
/events 4 List, get, search, aggregate
/rules 6 CRUD, reload
/cases 7 CRUD, assign, close, timeline
/dashboards 5 CRUD
/threat-intel 4 Indicators, feeds
/agents 5 List, get, isolate, actions
/cloud 3 Accounts, findings
/playbooks 4 CRUD, execute
/users 6 CRUD, roles
/system 6 Status, services, config, audit

Authentication: JWT Bearer tokens with HMAC-SHA256 signing. Token includes user ID, roles, and expiration. Middleware validates tokens on every protected route.

Rate limiting: Configurable per-minute rate limit (default 1000/min) with Redis-based distributed counting in production.

CORS: Configurable allowed origins with preflight handling.

11.2 gRPC

Internal service-to-service communication uses gRPC with Protocol Buffers for:

  • Type-safe RPC contracts
  • Binary serialization (smaller payloads than JSON)
  • Bidirectional streaming for real-time updates
  • HTTP/2 multiplexing for connection efficiency

11.3 Pre-Built Connectors

Connector Direction Protocol
ServiceNow Bidirectional REST API
Jira Bidirectional REST API
Splunk Export (forward) HEC (HTTP Event Collector)
QRadar Export (forward) REST API
Azure Sentinel Import Log Analytics API
TheHive Bidirectional REST API
MISP Import (TI feeds) REST API
VirusTotal Query (TI lookup) REST API
STIX/TAXII 2.1 Import (TI feeds) TAXII 2.1 API

12. Security & Compliance

12.1 Cryptography (C++)

AES-256-GCM with AES-NI

The TLSAccelerator class provides hardware-accelerated authenticated encryption:

// Encryption
EncryptedData encrypt_aes_gcm(plaintext, key, aad) {
    // Generate 12-byte random IV
    iv = random_bytes(12);
    // OpenSSL EVP uses AES-NI automatically
    ctx = EVP_CIPHER_CTX_new();
    EVP_EncryptInit_ex(ctx, EVP_aes_256_gcm(), ...);
    EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, 12, ...);
    EVP_EncryptInit_ex(ctx, nullptr, key, iv);
    // Add AAD if provided
    EVP_EncryptUpdate(ctx, nullptr, &len, aad, aad_len);
    // Encrypt plaintext
    EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, pt_len);
    EVP_EncryptFinal_ex(ctx, ciphertext + len, &final_len);
    // Get 16-byte GCM tag
    EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag);
    return {ciphertext, tag, iv, success=true};
}

Hardware acceleration: OpenSSL 3.0 automatically uses AES-NI instructions when available, providing 3-5x speedup over software AES. The has_aes_ni() method uses cpuid to detect AES-NI support at runtime.

CPU feature detection: The class also detects AVX2 and AVX-512 support via cpuid for SIMD-accelerated operations.

Hashing

  • SHA-256: Using OpenSSL SHA256() function (hardware-accelerated on modern CPUs)
  • SHA-3 (SHA3-256): Using OpenSSL EVP interface with EVP_sha3_256()
  • HMAC-SHA256: Using OpenSSL HMAC() function for message authentication

Key Management

The KeyRotationManager automatically rotates encryption keys:

  • Default rotation interval: 1 hour
  • Previous key retained for decryption of data encrypted with old key
  • needs_rotation() checks elapsed time since last rotation
  • rotate() generates a new 256-bit key using RAND_bytes()

Constant-time comparison: constant_time_compare() prevents timing attacks by XOR'ing all bytes and checking the result, rather than short-circuiting on first difference.

12.2 Authorization (Go)

RBAC with ABAC: Role-Based Access Control with Attribute-Based Access Control extensions:

Role Permissions
Admin Full access to all resources and configurations
Analyst Read alerts/events/rules/cases; create/update cases
Responder Execute playbooks; isolate hosts; block IPs
Viewer Read-only access to dashboards and alerts

JWT tokens include:

  • sub: User ID
  • roles: Array of role names
  • exp: Expiration timestamp
  • iat: Issued-at timestamp

Middleware chain: RequestID → Logger → Recovery → CORS → RateLimiter → Auth → RequireRole → Handler

Multi-tenant isolation: Each tenant has isolated data partitions, separate Kafka consumer groups, and separate API authentication. Tenant ID is extracted from JWT claims and used to scope all queries.

12.3 Audit Logging

All API actions (POST, PUT, DELETE) are logged to the audit log with:

  • User ID and IP address
  • Action (method + path)
  • Request body (sanitized)
  • Response status
  • Timestamp
  • Request ID (for trace correlation)

12.4 Compliance

Framework Implementation
SOC 2 Audit logging, access controls, encryption at rest/in transit
ISO 27001 Security management system, risk assessment, incident response
GDPR Data retention controls, right to erasure, data portability
HIPAA Encryption, access controls, audit trails, BAA support
PCI-DSS Network segmentation, log retention (1 year), file integrity monitoring
NIST 800-53 AC (Access Control), AU (Audit), SC (System & Comm Protection), IR (Incident Response)

13. Deployment Architecture

13.1 Kubernetes Deployment

AIGuardSIEM is deployed on Kubernetes with the following component topology:

┌─────────────────────────────────────────────────────┐
│                 Kubernetes Cluster                    │
│                                                     │
│  ┌───────────┐  ┌───────────┐  ┌───────────┐       │
│  │ Node Pool:│  │ Node Pool:│  │ Node Pool:│       │
│  │ Collectors│  │ Processing│  │  Storage  │       │
│  │ (c5.2xl)  │  │ (c5.4xl)  │  │ (r5.2xl)  │       │
│  └───────────┘  └───────────┘  └───────────┘       │
│                                                     │
│  ┌─────────────────────────────────────────┐        │
│  │ Node Pool: ML (g4dn.xlarge - GPU)       │        │
│  └─────────────────────────────────────────┘        │
│                                                     │
│  Services:                                          │
│  • Kafka (3 brokers, StatefulSet)                   │
│  • Syslog Collector (3 replicas, Deployment)        │
│  • PCAP Collector (2 replicas, hostNetwork)         │
│  • NetFlow Collector (2 replicas)                   │
│  • Stream Processor (4 replicas, HPA)               │
│  • ML Inference (2 replicas, GPU)                   │
│  • ClickHouse (3 shards, StatefulSet)               │
│  • API Gateway (2 replicas, HPA, Ingress)           │
│  • SOC Dashboard (1 replica)                        │
│  • SOAR Engine (1 replica)                          │
│  • etcd (3 nodes, for service discovery)            │
└─────────────────────────────────────────────────────┘

Node pool sizing:

Pool Instance Type CPU RAM Purpose
Collectors c5.2xlarge 8 vCPU 16GB High-throughput network I/O
Processing c5.4xlarge 16 vCPU 32GB CPU-intensive correlation + ML
Storage r5.2xlarge 8 vCPU 64GB Memory-heavy database workloads
ML (GPU) g4dn.xlarge 4 vCPU 16GB + T4 GPU GPU-accelerated inference

Auto-scaling: Horizontal Pod Autoscaler (HPA) scales stream processors based on CPU utilization (target 70%) and Kafka consumer lag. The orchestrator's auto-scale loop evaluates service health every 60 seconds.

13.2 Helm Chart

The Helm chart (deployment/helm/siem-xdr/) provides parameterized deployment:

helm install aiguard-siem deployment/helm/siem-xdr \
  --set global.storageClass=gp3 \
  --set collectors.syslog.replicas=5 \
  --set engine.streamProcessor.replicas=8 \
  --set mlInference.gpuEnabled=true \
  --set apiGateway.ingress.hostname=siem.company.com

Chart values control:

  • Replica counts per component
  • Resource requests/limits
  • Storage class and sizes
  • TLS configuration
  • Ingress hostname
  • Auto-scaling thresholds

13.3 Terraform Multi-Cloud

The Terraform configuration provisions infrastructure on AWS:

  • EKS cluster with 4 managed node groups (collectors, processing, storage, ML)
  • VPC with private subnets (3 AZs for HA), NAT gateways
  • S3 bucket for cold storage with versioning, encryption, lifecycle policies
  • Helm release that deploys AIGuardSIEM chart to the EKS cluster

13.4 Ansible for Bare Metal

For air-gapped or bare-metal deployments, the Ansible playbook:

  1. Creates directory structure (/opt/aiguard, /etc/aiguard, /var/lib/aiguard)
  2. Installs OS dependencies (Boost, OpenSSL, librdkafka, RocksDB, Go, Python)
  3. Copies configuration files and Sigma rules
  4. Builds C++ components with CMake (Release mode, -j$(nproc))
  5. Builds Go components (go build)
  6. Installs Python ML dependencies via pip
  7. Creates and enables systemd services for all components
  8. Verifies service health

13.5 Docker Compose (Development)

The docker-compose.yml provides a single-command development environment with all services:

  • Kafka (KRaft mode, no Zookeeper)
  • etcd for service discovery
  • ClickHouse for warm storage
  • MinIO for S3-compatible cold storage
  • All collectors, processors, API, dashboard, and SOAR engine

14. Performance Benchmarks

14.1 Data Ingestion

Component Metric Value
Syslog Collector (C++) Peak EPS 1,250,000
Syslog Collector (C++) Sustained EPS 500,000
Syslog Collector (C++) P99 latency 2.1ms
PCAP Collector (libpcap) Throughput 9.8 Gbps
PCAP Collector (DPDK) Throughput 10.0 Gbps (line rate)
PCAP Collector (DPDK) Packet loss 0%
NetFlow Collector Records/sec 300,000

14.2 Stream Processing

Metric Value
Events processed/sec 750,000
Correlation rules 500
Avg processing latency 0.8ms
P99 processing latency 4.2ms
Alerts generated/sec 1,200
Active windows 100,000

14.3 ML Inference

Model Device P50 Latency P99 Latency Throughput
Random Forest CPU (INT8) 1.2ms 2.8ms 833K/s
XGBoost CPU (INT8) 1.5ms 3.1ms 667K/s
Isolation Forest CPU 0.8ms 1.9ms 1.25M/s
LSTM (seq=10) CPU 3.2ms 7.5ms 312K/s
LSTM (seq=10) GPU (A100) 0.8ms 1.5ms 1.25M/s
CNN (payload) GPU (A100) 1.1ms 2.0ms 909K/s
Ensemble (all) GPU (A100) 4.5ms 8.2ms 222K/s

14.4 Storage

Tier Metric Value
Hot (LSM) Write throughput 850K ops/sec
Hot (LSM) Point read latency 0.3ms
Hot (LSM) Range query (1K keys) 1.8ms
Hot (LSM) Compression ratio 4.2:1 (zstd)
Warm (ClickHouse) Insert throughput 500K rows/sec
Warm (ClickHouse) Aggregation query 12ms
Warm (ClickHouse) Compression ratio 8.5:1
Cold (S3/Parquet) Compression ratio 10.2:1
Cold (S3/Parquet) Retrieval latency 200ms-5s

14.5 End-to-End Detection Latency

Stage Latency
Collector parse + Kafka produce 1.5ms
Kafka delivery 2.0ms
Stream processor consume 0.5ms
Correlation engine 0.8ms
ML inference 3.2ms
Alert generation + produce 1.0ms
Total (P99) 8.0ms
Total (P99.9) 15.2ms

14.6 Availability

Metric Value
Uptime (30-day test) 99.997%
Auto-failover time 3.2s
Zero data loss events 0
Kafka consumer rebalance 5.8s

15. Threat Model & Attack Surface

15.1 Threats to AIGuardSIEM Itself

Threat Mitigation
Tampering with detection rules Audit logging, RBAC, rule versioning, change review workflow
ML model poisoning Training data validation, model signing, drift detection
Kafka data exfiltration TLS encryption, SASL authentication, network policies
API abuse Rate limiting, JWT validation, IP allowlisting, CORS restrictions
Supply chain attacks Dependency pinning, SBOM generation, container image scanning
Side-channel attacks Constant-time comparison, memory zeroing, no secret logging
Insider threats Multi-tenant isolation, audit trails, least-privilege RBAC
DDoS on collectors Non-blocking I/O, ring buffer backpressure, auto-scaling

15.2 Defense in Depth

Layer 1: Network Security
   └→ TLS 1.3 for all inter-service communication
   └→ AES-256-GCM for data at rest
   └→ Network policies (K8s) for pod-to-pod restrictions

Layer 2: Authentication & Authorization
   └→ JWT + OAuth2 for API access
   └→ RBAC with ABAC extensions
   └→ Multi-tenant isolation
   └→ Service mesh mTLS (optional)

Layer 3: Application Security
   └→ Input validation on all API endpoints
   └→ Parameterized queries (no SQL injection)
   └→ Rate limiting and request size limits
   └→ CSRF protection

Layer 4: Monitoring & Detection
   └→ Self-monitoring (SIEM monitoring itself)
   └→ Audit logging of all administrative actions
   └→ Drift detection for ML models
   └→ Health checks and alerting

Layer 5: Incident Response
   └→ SOAR playbooks for self-remediation
   └→ Automated host isolation
   └→ Evidence collection and preservation

16. Future Roadmap

16.1 Near-Term (3-6 months)

  • Graph Neural Networks (GNN): Lateral movement detection using graph-based models that analyze host-to-host communication patterns
  • Transformer models: Attention-based threat correlation for multi-step attack chain detection
  • Online learning: Incremental model updates from analyst feedback (true positive / false positive labels)
  • YARA-L support: Google Chronicle's YARA-L rule language for rule-based detection
  • Federated learning: Cross-organization model training without sharing raw data

16.2 Mid-Term (6-12 months)

  • Real-time threat hunting: Interactive query language with sub-second response on hot data
  • Automated playbooks: AI-driven playbook generation based on alert patterns
  • Deception technology: Honeytoken deployment and canary event detection
  • Mobile app: Native iOS/Android app for on-call analysts
  • OpenTelemetry support: Native OTel ingestion for application security telemetry

16.3 Long-Term (12+ months)

  • Quantum-resistant cryptography: Post-quantum algorithm support (CRYSTALS-Kyber, Dilithium)
  • Zero Trust integration: Continuous device trust scoring and conditional access
  • Autonomous SOC: End-to-end automated triage, investigation, and response with human-in-the-loop approval
  • Multi-modal detection: Fusing network, endpoint, and cloud telemetry for holistic attack detection
  • Natural language querying: LLM-powered natural language to detection rule translation

Appendix A: Technology Stack

C++ Components

Library Version Purpose
C++ Standard C++20 Language standard
Boost 1.82+ Lock-free queues, graph, program_options
fmt 10.1.1 Fast string formatting
spdlog 1.12.0 High-performance logging
OpenSSL 3.0+ TLS, AES, SHA, HMAC
librdkafka 2.0+ Kafka producer/consumer
RocksDB 8.0+ Embedded key-value store
nlohmann/json 3.11+ JSON serialization
ONNX Runtime 1.17+ ML model inference
GoogleTest 1.14.0 Unit testing
CMake 3.22+ Build system

Go Components

Library Version Purpose
Go 1.22+ Language
Gin 1.9.1 HTTP web framework
gorilla/websocket 1.5.1 WebSocket support
segmentio/kafka-go 0.4.42 Kafka client
golang-jwt 5.2.0 JWT authentication
etcd client 3.5.11 Service discovery
gRPC 1.60.1 Internal RPC
AWS SDK v2 1.24.0 AWS integration
ClickHouse Go 2.18.0 ClickHouse client
Prometheus client 1.18.0 Metrics export
zap 1.26.0 Structured logging
testify 1.8.4 Unit testing

Python Components

Library Version Purpose
Python 3.11+ Language
scikit-learn 1.4.0 Random Forest, Isolation Forest
XGBoost 2.0.3 Gradient boosted trees
PyTorch 2.2.0 LSTM, CNN models
ONNX Runtime 1.17.0 Model inference
skl2onnx - Model export to ONNX
pandas 2.1.0 Data manipulation
numpy 1.26.0 Numerical computing
Dash 2.14.0 Dashboard framework
Plotly 5.18.0 Chart visualization
kafka-python 2.0.2 Kafka client
Poetry - Dependency management

Infrastructure

Technology Purpose
Kafka (KRaft) Event streaming bus
etcd Service discovery & configuration
ClickHouse Warm storage (columnar)
MinIO / S3 Cold storage (object)
Kubernetes Container orchestration
Helm K8s package management
Terraform Infrastructure as Code
Ansible Configuration management
Docker Container runtime
Prometheus Metrics collection
Grafana Metrics visualization

Appendix B: Glossary

Term Definition
SIEM Security Information and Event Management - centralized security log aggregation, correlation, and alerting
XDR Extended Detection and Response - SIEM extended with endpoint, network, and cloud visibility
SOAR Security Orchestration, Automation, and Response - automated playbook execution for incident response
UEBA User and Entity Behavior Analytics - ML-based behavioral baselining and anomaly detection
ECS Elastic Common Schema - standardized field naming for security events
EPS Events Per Second - throughput metric for event ingestion
DPDK Data Plane Development Kit - kernel-bypass packet processing for line-rate capture
eBPF Extended Berkeley Packet Filter - in-kernel programmable tracing without kernel modules
LKM Linux Kernel Module - loadable kernel module for system call interception
LSM-tree Log-Structured Merge-tree - write-optimized data structure for high-throughput storage
SSTable Sorted String Table - immutable sorted key-value file on disk
ONNX Open Neural Network Exchange - portable model format for cross-platform inference
INT8 8-bit integer quantization - reduces model size and improves CPU inference speed
AVX-512 Advanced Vector Extensions 512-bit - SIMD instructions for 64-byte parallel operations
AES-NI AES New Instructions - hardware acceleration for AES encryption
GCM Galois/Counter Mode - authenticated encryption mode for AES
MITRE ATT&CK Knowledge base of adversary tactics and techniques
Sigma Generic signature format for SIEM detection rules
CICFlowMeter Network flow feature extractor generating 84+ statistical features
Bloom Filter Probabilistic data structure for fast set membership testing
Welford's Algorithm Online algorithm for computing running mean and variance
WORM Write-Once-Read-Many - compliance storage that prevents modification
RBAC Role-Based Access Control
ABAC Attribute-Based Access Control
JWT JSON Web Token - stateless authentication token
PSI Population Stability Index - metric for model drift detection

This whitepaper documents AIGuardSIEM Version 1.0. For the latest updates, refer to the project repository and release notes.

© 2025 AIGuard. All rights reserved. Licensed under MIT.