Architecture Note · AI & Edge Infrastructure
Deterministic Edge Log Cost-Reduction Pipeline: Cardinality Caps, VPC Scrubbing, and SRE Gates
Why LLM log classifiers create egress and incident-blindness risks—and how ordered Vector and OpenTelemetry rules, in-VPC redaction, Zstd Parquet archiving, and mandatory SRE sign-off cut ingestion spend safely.
The Operational Problem: Telemetry Spend Driven by Noise and Unbounded Labels
Multi-region Kubernetes and edge fleets routinely push 3,200 to 6,400 GB/day into Datadog Logs, APM, or Splunk Cloud, only for platform teams to discover that over half of that volume carries near-zero diagnostic value. Readiness and liveness probes (/healthz, kube-probe/1.29), Envoy 200 OK access chatter, Prometheus /metrics scrape logs, and verbose DEBUG grpc.pool stacktraces dominate hot-index bills.
Simultaneously, unbounded labels—such as request_id, trace_id, user_uuid, ephemeral pod_ip addresses, and session_token—multiply across services and pods to create millions of active custom metric series. Worse still, raw application logs frequently emit Authorization: Bearer headers, JWTs, AWS AKIA keys, payment card PANs, and customer emails directly to external vendor APIs before anyone inspects the stream.
Why Naive AI Wrappers Fail in Production Telemetry Pipelines
Routing raw telemetry through a generic LLM wrapper to “summarize or filter noisy logs” fails core reliability and security invariants:
- Unredacted egress before inspection: Sending raw NDJSON batches to an external model endpoint leaks bearer tokens, cloud credentials, and customer PII outside the VPC boundary before filtering even begins.
- Nondeterministic drops and missing error protection: Probabilistic classifiers cannot guarantee deterministic retention of
ERRORevents or immutable Business Audit trails. One misclassified burst during a payment or clearing outage silently destroys forensic evidence. - Inconsistent math and cardinality blind spots: Language models approximate volume reductions instead of computing exact UTF-8 byte deltas,
1-in-Nsampling ratios, or series multipliers across pods and labels. - Ungated collector mutations: Emitting unvalidated YAML snippets without schema checks, config versioning, or human change-ticket attribution invites production collector outages.
The Deterministic Architecture That Fixes It
Our pipeline treats observability cost reduction as deterministic edge compilation backed by a local FastAPI and SQLite (WAL mode) control plane:
- In-VPC secret and PII scrubbing: Before logs cross the VPC boundary—and inside
POST /api/pipelines/simulate—explicit pattern and checksum rules maskAuthorization: Bearertokens, three-segment JWTs, AWSAKIAkeys, GitHubghp_and Stripesk_live_tokens, and RFC email addresses. Payment PAN candidates (13–19 digits) pass through Luhn checksum verification so genuine card numbers redact cleanly while non-Luhn order IDs stay intact. - Ordered rule chain with unconditional audit preservation: Rules evaluate top-to-bottom across four deterministic transforms—
drop, deterministic1-in-ratesample,aggregate(rolling logs into compact OTel or DogStatsD counter and histogram series), andredact—while hard-protectinglevel == "ERROR"and Business Audit lines regardless of rule order. Uploaded NDJSON samples are tracked intemp_uploadswith a 1-hour TTL (created_at + 3600s) and securely zero-overwritten by the cleanup sweeper. - Deterministic cardinality guard:
POST /api/cardinality/analyze(defaulting toOfflineDeterministicAdapterwith zero external API keys) scans label sets for UUIDs, hex trace IDs, and ephemeral pod IPs, computes the exact series multiplier, and prescribes bucketing into bounded tiers or stripping tags from hot metrics while retaining them in cold logs. - Hot-index shaping plus 5.5:1 Zstd Parquet replay: Shaped high-signal streams flow to the hot index, while 100% of raw scrubbed logs archive to S3 Intelligent-Tiering or GCS Coldline as Zstd-compressed Parquet for on-demand incident replay.
- Versioned YAML and mandatory SRE approval gate:
POST /api/pipelines/deployvalidates generatedvector.yamlandotel.yamlconfigs in SQLite (pipeline_versions) and returnsHTTP 409 Conflictfor production targets until an SRE Lead signs off viaPOST /api/pipelines/{version_id}/approvewith approver name and change ticket. Every deployment, approval, andGET /api/savings/reportexport appends to a trigger-protected, SHA-256 hash-chainedaudit_logstable and sanitizes CSV cells against RFC 4180 formula injection.
Operational Takeaway
Cutting observability spend by 55–78% does not require trusting probabilistic AI filters with production incident logs. When edge redaction runs locally inside the VPC, ordered rules protect errors and audit trails deterministically, raw events remain replayable in Zstd Parquet, and every collector YAML change waits on SRE sign-off, platform teams reclaim budget without sacrificing visibility.