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 ERROR events 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-N sampling 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:

  1. In-VPC secret and PII scrubbing: Before logs cross the VPC boundary—and inside POST /api/pipelines/simulate—explicit pattern and checksum rules mask Authorization: Bearer tokens, three-segment JWTs, AWS AKIA keys, GitHub ghp_ and Stripe sk_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.
  2. Ordered rule chain with unconditional audit preservation: Rules evaluate top-to-bottom across four deterministic transforms—drop, deterministic 1-in-rate sample, aggregate (rolling logs into compact OTel or DogStatsD counter and histogram series), and redact—while hard-protecting level == "ERROR" and Business Audit lines regardless of rule order. Uploaded NDJSON samples are tracked in temp_uploads with a 1-hour TTL (created_at + 3600s) and securely zero-overwritten by the cleanup sweeper.
  3. Deterministic cardinality guard: POST /api/cardinality/analyze (defaulting to OfflineDeterministicAdapter with 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.
  4. 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.
  5. Versioned YAML and mandatory SRE approval gate: POST /api/pipelines/deploy validates generated vector.yaml and otel.yaml configs in SQLite (pipeline_versions) and returns HTTP 409 Conflict for production targets until an SRE Lead signs off via POST /api/pipelines/{version_id}/approve with approver name and change ticket. Every deployment, approval, and GET /api/savings/report export appends to a trigger-protected, SHA-256 hash-chained audit_logs table 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.

Quantify your telemetry savings on a real NDJSON sample

Start with a free 30-minute workflow check. Bring a sample 1,000-line log export or Datadog/Splunk usage summary and leave with a concrete edge-pipeline recommendation in writing within one business day.