Skip to content

Data Flow

BGP Event Processing

1. Ingestion

RIPE RIS WebSocket


┌──────────────┐
│   Parse      │  Extract: timestamp, prefix, origin_asn, as_path, type
│   Message    │
└──────────────┘


┌──────────────┐
│   Validate   │  Check message structure, filter noise
└──────────────┘


┌──────────────┐
│   Batch      │  Accumulate 1000 events or 5 second timeout
└──────────────┘


┌──────────────┐
│   Write      │  Bulk insert to ClickHouse bgp_events
└──────────────┘

2. Aggregation

ClickHouse Materialized Views automatically compute:

  • bgp_daily_mv: Daily announcement/withdrawal counts per ASN
  • threat_daily_mv: Daily threat event counts per ASN

3. Scoring

Triggered by Celery beat scheduler or on-demand:

┌──────────────┐
│  Query       │  Read aggregates from ClickHouse
│  ClickHouse  │
└──────────────┘


┌──────────────┐
│  Calculate   │  Apply scoring formula
│  Scores      │
└──────────────┘


┌──────────────┐
│  Update      │  Write to asn_registry, asn_signals
│  PostgreSQL  │
└──────────────┘


┌──────────────┐
│  Record      │  Append to asn_score_history
│  History     │
└──────────────┘

Threat Feed Processing

Sources

FeedTypeUpdate Interval
Spamhaus DROPIP blocklist1 hour
Spamhaus EDROPASN blocklist1 hour
URLhausMalware URLs1 hour
PhishTankPhishing URLs1 hour

Processing Pipeline

┌──────────────┐
│  Fetch       │  HTTP GET from feed URLs
│  Feed        │
└──────────────┘


┌──────────────┐
│  Parse       │  Extract IPs, domains, ASNs
└──────────────┘


┌──────────────┐
│  Resolve     │  Map IPs/domains to origin ASN
└──────────────┘


┌──────────────┐
│  Write       │  Insert to threat_events
└──────────────┘

Query Flow

Score Query

Client Request: GET /asn/15169


┌──────────────┐
│  Validate    │  Check API key, rate limit
│  Request     │
└──────────────┘


┌──────────────┐
│  Query       │  SELECT from asn_registry JOIN asn_signals
│  PostgreSQL  │
└──────────────┘


┌──────────────┐
│  Generate    │  Build human-readable explanations
│  Details     │
└──────────────┘


┌──────────────┐
│  Return      │  JSON response
│  Response    │
└──────────────┘

History Query

Client Request: GET /asn/15169/history


┌──────────────┐
│  Query       │  SELECT from asn_score_history
│  ClickHouse  │
└──────────────┘


┌──────────────┐
│  Return      │  JSON array of timestamp/score pairs
│  Response    │
└──────────────┘

Data Retention

TableRetentionPurpose
bgp_events30 daysRaw event analysis
threat_events90 daysThreat investigation
asn_score_history365 daysTrend analysis
bgp_daily_mvIndefiniteHistorical metrics

ASN Risk Intelligence Platform