Delivered remotely for a business based in Tel Aviv, Israel. Names withheld by agreement.
Project Overview
Modern enterprise networks emit continuous streams of authentication assertions, DNS lookups, endpoint process trees, and cloud control-plane logs across hybrid environments. Traditional SIEM deployments frequently collapse under two compounding pressures: rigid threshold rules either miss slow-moving lateral movement or flood analysts with context-free notifications, while raw log stores lag behind real-time triage when storage indexes bloat.
We designed and built an AI cybersecurity monitoring platform centered on Python, FastAPI, and Elasticsearch. The system ingests heterogeneous security telemetry through durable streaming queues, normalizes events into a consistent entity model, evaluates both signature rules and statistical behavioral models, and surfaces correlated incident narratives through an API-first investigation engine.
SOC Ingestion & Triage Bottlenecks
Before this platform was built, security teams operated across disconnected log silos that created severe operational friction during active investigations:
- Schema fragmentation across vendors: Firewalls, identity providers, and endpoint agents logged timestamps, user principals, and source addresses under incompatible field names, forcing analysts to rewrite ad-hoc queries for each data source.
- Disconnected alert storms: A single phishing compromise routinely generated dozens of isolated low-level alerts across DNS, proxy, and IAM logs without linking them to the originating session.
- Model opacity during incident response: Black-box anomaly scores without supporting feature attributions left responders unable to distinguish benign administrative scripts from genuine privilege escalation.
- Query contention under load: Heavy threat-hunting aggregations over multi-terabyte indices competed directly with real-time rule evaluation, stalling ingestion during high-volume security events.
Architectural Strategy
We anchored the platform around a two-stage detection and correlation architecture built over a canonical event schema. Every incoming log payload is parsed once in Python into Elastic Common Schema fields, enriched inline with asset criticality and threat indicators cached in Redis, and written to time-partitioned Elasticsearch data streams.
Rather than running heavyweight deep-learning inference on every raw packet record, Python workers maintain compact behavioral feature vectors per user, host, and service account. Lightweight statistical checks and PyTorch sequence models score rare process chains, off-hours authentication hops, and atypical data egress only on enriched session summaries—preserving deterministic latency while giving analysts transparent feature explanations alongside every elevated risk score.
Core Capabilities
- Unified Telemetry Normalization: Python stream consumers parse syslog, JSON, CEF, and cloud audit trails into typed entity records linking users, hosts, processes, and network sockets.
- Hybrid Rule & AI Detection: Executes deterministic behavioral detections in tandem with PyTorch anomaly scoring trained on historical tenant baselines for impossible travel, token replay, and anomalous child processes.
- Entity-Centric Incident Correlation: Groups related detections across time windows into coherent attack stories annotated with MITRE ATT&CK tactics, affected assets, and supporting raw log pointers.
- FastAPI Investigation & SOAR API: Exposes paginated threat-hunting search, timeline reconstruction, indicator pivots, and signed webhook triggers for automated host isolation or credential revocation.
- Dynamic IOC & Asset Enrichment: Joins live events against STIX/TAXII threat feeds and internal CMDB ownership tables via Redis without adding cross-service lookup stalls.
Technical Architecture
Telemetry forwarders push encrypted event batches into Apache Kafka topics partitioned by tenant and source category. Stateless Python normalization workers consume those partitions, apply schema validation, enrich IP addresses and principals via Redis lookup tables, and bulk-index documents into Elasticsearch hot nodes. Concurrently, sliding-window aggregators update entity behavioral profiles and emit scored detection candidates. FastAPI serves the web analyst console and external automation clients, reading case state from PostgreSQL and pivoting into Elasticsearch for sub-second timeline queries.
Flow: Telemetry Collectors → Apache Kafka Topics → Python Normalization & Redis Enrichment → Elasticsearch Data Streams + PyTorch Anomaly Scorers → Correlation Engine → FastAPI Investigation & SOAR API
Separating stateless Kafka consumers from the FastAPI query tier lets engineering teams scale ingestion throughput independently from analyst search concurrency and scheduled threat-hunting jobs.
Technology Stack
| Category | Technology detail |
|---|---|
| Ingestion Bus | Apache Kafka buffering high-burst firewall, EDR, and cloud audit event streams |
| Stream Normalization | Python workers parsing raw syslog, JSON, and CEF into Elastic Common Schema |
| Search & Log Store | Elasticsearch hot-warm-cold index lifecycle storing searchable security telemetry |
| Detection & Scoring | PyTorch sequence and isolation models scoring lateral movement and credential anomalies |
| API & Orchestration | FastAPI serving investigation queries, rule management, and SOAR playbook webhooks |
| Relational Metadata | PostgreSQL persisting case histories, analyst assignments, and detection rule versions |
| Entity & Window Cache | Redis holding rolling host baselines, IOC bloom lookups, and alert deduplication keys |
| Threat Intel Feeds | STIX/TAXII polling jobs enriching IP, domain, and file-hash indicators in flight |
| Observability | Structured pipeline lag metrics tracking ingestion delay and model inference health |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Controlling Elasticsearch cluster costs under multi-month log retention | Implemented hot-warm-cold Index Lifecycle Management with rollup summaries for long-term baselines; accepts slightly slower cold-tier restores in exchange for predictable hot-node memory footprints. |
| Explaining ML-flagged anomalies to skeptical SOC responders | Paired PyTorch anomaly scores with SHAP-style top contributing feature tags and direct links to baseline peer behavior; increases per-alert metadata size while eliminating opaque risk scores. |
| Preventing duplicate alerts from flooding incident queues | Used Redis-backed sliding-window deduplication keyed on (tenant, rule_id, entity_id) to append evidence onto open cases; trades immediate standalone alert fan-out for cleaner analyst triage queues. |
| Avoiding query timeouts during broad regex hunts | Enforced FastAPI query guardrails using async search cursors, bounded time ranges, and keyword-indexed subfields instead of wildcard scans on raw message bodies. |
Security & Reliability
A monitoring platform guarding sensitive security logs is itself a high-value target. All collector transport terminates over mutual TLS, and tenant isolation is enforced across Kafka topic routing, Elasticsearch index aliases, and PostgreSQL row-level access controls checked on every FastAPI request. Analysts interact strictly through role-scoped OAuth/OIDC tokens with field-level masking for sensitive payload attributes such as session cookies or PII embedded in URLs.
To guarantee forensic integrity, raw ingested events write into append-only Elasticsearch data streams protected from manual edits, while analyst case notes, rule edits, and suppression actions record into an immutable PostgreSQL audit ledger. If downstream Elasticsearch nodes experience transient saturation or rolling upgrades, Kafka retention buffers incoming telemetry safely on replicated storage so zero security events are discarded.
Performance & Scale
Log ingestion and search workloads vary dramatically between quiet overnight baselines and active incident bursts. Python ingestion services batch documents dynamically by byte size and flush interval, compressing bulk payloads before hitting Elasticsearch ingest nodes. Hot indices reside on NVMe-backed nodes tuned with pre-mapped keyword and IP field types, avoiding costly runtime dynamic mapping updates.
In the query layer, FastAPI uses asynchronous Elasticsearch clients and short-lived Redis caches for repetitive dashboard widgets, IOC reputation lookups, and MITRE tactic breakdowns. Feature vectors for AI scoring update incrementally in streaming windows rather than re-scanning historical indices, keeping inference overhead flat even as total archived log volume grows steadily over time.
Operational Outcomes
Consolidating disparate telemetry pipelines into an AI-assisted FastAPI and Elasticsearch platform reshaped daily SOC execution:
- Coherent incident timelines: Correlating network, identity, and endpoint signals around shared entities allows analysts to inspect complete attack progressions rather than triaging isolated log lines.
- Explainable behavioral detections: Pairing statistical anomaly models with concrete baseline deviations equips Tier-1 and Tier-2 responders to validate suspicious automation or credential misuse quickly.
- Resilient burst handling: Kafka buffering and tiered Elasticsearch storage maintain uninterrupted ingestion and responsive search behavior during noisy DDoS events or credential-stuffing waves.
- Programmable containment: Clean FastAPI endpoints and signed SOAR webhooks bridge detection directly into identity revocation and endpoint quarantine workflows without manual copy-paste.