<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Premdeep Singh</title>
    <description>The latest articles on DEV Community by Premdeep Singh (@premdeepsingh).</description>
    <link>https://dev.to/premdeepsingh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4105743%2F68242f25-9b8c-4187-ae74-1e46adf704ae.png</url>
      <title>DEV Community: Premdeep Singh</title>
      <link>https://dev.to/premdeepsingh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/premdeepsingh"/>
    <language>en</language>
    <item>
      <title>How Lossless Log Compression Actually Works: Schema-Aware Encoding vs. gzip/zstd</title>
      <dc:creator>Premdeep Singh</dc:creator>
      <pubDate>Sat, 05 Sep 2026 07:53:35 +0000</pubDate>
      <link>https://dev.to/premdeepsingh/how-lossless-log-compression-actually-works-schema-aware-encoding-vs-gzipzstd-4gff</link>
      <guid>https://dev.to/premdeepsingh/how-lossless-log-compression-actually-works-schema-aware-encoding-vs-gzipzstd-4gff</guid>
      <description>&lt;p&gt;Every backend engineer has had this conversation at least once: retention gets cut from 90 days to 30, or verbosity gets dialed down in production, because the storage bill for logs quietly became a line item someone in finance started asking about. It usually gets framed as a tooling problem — "we need a cheaper log platform" — but it's actually an encoding problem, and most teams never get far enough to notice, because gzip and zstd are "good enough" and switching compressors feels like a solved problem not worth revisiting.&lt;/p&gt;

&lt;p&gt;It isn't solved. It's just under-examined. Here's the actual gap, and why domain-specific encoding closes it in a way generic compression fundamentally can't.&lt;/p&gt;

&lt;p&gt;The concrete case study: Uber's HDFS bill&lt;/p&gt;

&lt;p&gt;In 2022, Uber's engineering team published the numbers behind a problem a lot of platform teams will recognize immediately. Their Spark platform was generating up to 200TB of logs a day across roughly 250,000 jobs, and log retention on HDFS was capped at three days — not because three days was enough, but because it was what the storage budget could absorb. Engineers kept asking for a month of retention. Doing that naively, at existing compression, would have taken the HDFS storage bill for these logs from $180K a year to $1.8M.&lt;/p&gt;

&lt;p&gt;Instead of buying more storage or negotiating a better rate, Uber's team adopted CLP — the Compressed Log Processor, originally developed as academic research at the University of Toronto — and restructured how the logs were encoded before they ever hit disk. The result: a 169:1 compression ratio, HDFS costs down to roughly $10K a year, and retention extended to a full month. Not a smaller version of the same tradeoff. An order-of-magnitude-plus improvement, achieved entirely at the encoding layer, with no data thrown away.&lt;/p&gt;

&lt;p&gt;That last part matters and gets glossed over constantly: this wasn't sampling, filtering, or dropping DEBUG-level noise. It was lossless — every byte of the original log, recoverable exactly, just represented far more efficiently on disk.&lt;/p&gt;

&lt;p&gt;Why gzip and zstd leave this much on the table&lt;/p&gt;

&lt;p&gt;gzip and zstd are excellent general-purpose compressors. That's exactly the problem. They're built to compress any byte stream reasonably well — source code, binaries, images, log files, JSON blobs — without knowing anything about the structure of what they're compressing. A generic compressor sees a log line as an undifferentiated string and finds repetition using a sliding window (LZ77-family matching) plus entropy coding on top. That works, and it's why zstd is a sane default almost everywhere. But it's leaving structure-specific redundancy on the table, because it isn't looking for it.&lt;/p&gt;

&lt;p&gt;A log line has a shape a generic compressor doesn't get to exploit directly:&lt;/p&gt;

&lt;p&gt;2026-08-14T03:12:07.441Z ERROR [payment-service] user_id=48213 order_id=990214 failed to charge card: insufficient_funds&lt;/p&gt;

&lt;p&gt;To a byte-stream compressor, this is just bytes. But structurally, it's a small number of variable fields (the timestamp, the user_id, the order_id, the specific error) sitting inside a large amount of constant scaffolding that repeats, nearly verbatim, across millions of other lines from the same log statement. CLP's actual approach — and the approach any schema-aware system worth using takes — is to explicitly separate a log message into:&lt;/p&gt;

&lt;p&gt;The static template — everything about the message that comes from the log statement itself, shared across every occurrence of that call site (ERROR [payment-service] user_id=... order_id=... failed to charge card: ...)&lt;br&gt;
The variable values — the specific timestamp, IDs, and dynamic values that differ per occurrence&lt;br&gt;
Dictionaries built per-field-type — because order_id values compress very differently than free-text error messages, and treating them as one undifferentiated blob wastes the specific redundancy each field type has on its own&lt;/p&gt;

&lt;p&gt;Once you've split a log stream this way, you're no longer compressing "text." You're compressing a small number of unique templates plus a column of variables per field — and each of those columns is enormously more repetitive, on its own, than the interleaved original ever was. This is essentially the same intuition behind columnar formats like Parquet applied to log semantics instead of tabular data: group like with like, then compress each group with an encoding suited to it, rather than compressing everything with one generic pass.&lt;/p&gt;

&lt;p&gt;CLP's own published benchmarks back this up directly: even before the final columnar archiving step, its intermediate representation format outperforms general-purpose compressors like Zstandard, and a second compression pass over that intermediate representation roughly doubles the ratio again — which is exactly the aggregate multi-hundred-x result Uber saw in production.&lt;/p&gt;

&lt;p&gt;The part that matters more than the ratio: searchability&lt;/p&gt;

&lt;p&gt;Here's where a lot of "just compress it more" thinking falls apart in practice. A compression ratio is worthless operationally if getting your data back means decompressing gigabytes to grep through them. That's the actual reason most teams don't push compression harder already — they've internalized, correctly, that better compression usually means worse query latency, because you're trading disk space for CPU time on every read.&lt;/p&gt;

&lt;p&gt;Schema-aware log compression sidesteps this because of what got separated out in the first place. If your variable fields are stored in structured, typed columns rather than buried inside opaque compressed text, you can push a query — "give me every ERROR from payment-service where order_id=990214" — down to the structural level: filter by template category and scan the relevant variable column, without ever fully decompressing the surrounding message text you don't care about. CLP's design explicitly supports search over the compressed representation without full decompression, which is the difference between "compression as an archival tradeoff" and "compression as a strict upgrade."&lt;/p&gt;

&lt;p&gt;Where lossless schema-aware compression should actually be applied&lt;/p&gt;

&lt;p&gt;This approach isn't equally valuable everywhere, and it's worth being honest about where the win comes from:&lt;/p&gt;

&lt;p&gt;High cardinality, high repetition data — application logs, structured audit events, access logs — is the sweet spot. Lots of near-identical templates, lots of low-entropy repeated scaffolding.&lt;br&gt;
Metrics and traces benefit from a related but distinct approach, since they're already more structured; the gains come more from columnar encoding and delta-encoding of sequential values (timestamps, counters) than from template extraction.&lt;br&gt;
Genuinely high-entropy data — already-compressed binaries, encrypted payloads, random IDs with no shared structure — won't benefit much from any of this, because there's no redundancy to expose in the first place. No compression scheme, schema-aware or not, manufactures redundancy that isn't there.&lt;br&gt;
Regulated retention specifically rewards the "lossless" half of this harder than most workloads, because the entire point of a compliance-driven retention requirement — SOX, PCI DSS, HIPAA — is that the original record has to be recoverable, not a statistically-representative approximation of it. A compression scheme that hits a great ratio by discarding rare fields or coarsening timestamps doesn't satisfy that requirement no matter how good the number looks in a benchmark.&lt;br&gt;
The engineering takeaway&lt;/p&gt;

&lt;p&gt;If your team is choosing between "ship less data" and "compress harder," it's usually worth checking whether you're actually compressing as hard as the structure of your data allows before deciding you have to throw data away. Uber didn't extend retention 10x by negotiating a storage discount or accepting lossier logging. They changed the unit of compression from "bytes" to "log template + typed variables," and let the compressor do dramatically less redundant work per byte stored.&lt;/p&gt;

&lt;p&gt;That's the same principle we've built our own ingestion pipeline around at Sasquatch Labs — schema-aware, lossless compression tuned per telemetry type, verified byte-for-byte against the original on every event, so "more retention" and "smaller bill" stop being a tradeoff you have to negotiate between finance and whoever owns the audit.&lt;/p&gt;

&lt;p&gt;References&lt;/p&gt;

&lt;p&gt;Uber Engineering, Reducing Logging Cost by Two Orders of Magnitude Using CLP&lt;br&gt;
Uber Engineering, Modernizing Logging at Uber with CLP (Part II)&lt;br&gt;
Y-Scope, CLP: Compressed Log Processor (GitHub)&lt;br&gt;
Luo, J.Y., CLP: Efficient and Scalable Search on Compressed Text Logs, University of Toronto&lt;br&gt;
InfoQ, Uber Reduces Logging Costs by 169x Using Compressed Log Processor (CLP)&lt;/p&gt;

</description>
      <category>backend</category>
      <category>data</category>
      <category>performance</category>
    </item>
    <item>
      <title>I Used to Use Splunk. Here’s Why My Team Switched</title>
      <dc:creator>Premdeep Singh</dc:creator>
      <pubDate>Wed, 02 Sep 2026 08:29:22 +0000</pubDate>
      <link>https://dev.to/premdeepsingh/i-used-to-use-splunk-heres-why-my-team-switched-4jn2</link>
      <guid>https://dev.to/premdeepsingh/i-used-to-use-splunk-heres-why-my-team-switched-4jn2</guid>
      <description>&lt;p&gt;(And Why Our Security Budget Loves Us Now)&lt;/p&gt;

&lt;p&gt;Let’s start with a scene you might recognize.&lt;/p&gt;

&lt;p&gt;My last team managed infrastructure for a mid-sized fintech. We ran Kubernetes in AWS. We used Datadog for observability. And we poured all our security logs into Splunk. Our security team loved us for it. The compliance team loved us for it. And then, one morning, our CFO did not.&lt;/p&gt;

&lt;p&gt;He printed out our cloud spend report, walked over to the CISO, and pointed at a single line item.&lt;/p&gt;

&lt;p&gt;“Splunk: $650K this year. Growing.”&lt;/p&gt;

&lt;p&gt;Then he asked the question nobody in the room had an answer for.&lt;/p&gt;

&lt;p&gt;“What exactly are we paying for? And why would we make this trade twice?”&lt;/p&gt;

&lt;p&gt;Cut to this year. Different company, different team. Same problem — we generate hundreds of gigabytes of logs a day. Same regulatory requirements — we handle PII, PCI-DSS, CCPA, and SOC2 audits. Same need for real-time threat detection and historical forensics.&lt;/p&gt;

&lt;p&gt;Only this time, our Splunk equivalent costs us $28K a year. Not $650K.&lt;/p&gt;

&lt;p&gt;The bill shows up on AWS, not on a vendor invoice. We own the encryption keys. We control the data retention policies. We can run a compliance export in minutes, without filing a support ticket.&lt;/p&gt;

&lt;p&gt;Here’s what changed.&lt;/p&gt;

&lt;p&gt;We Stopped Paying for Data Just to Move It&lt;br&gt;
The first thing I learned in my old job: your Splunk bill mostly pays for data transfer.&lt;/p&gt;

&lt;p&gt;Every authentication event, every NGINX log, every Kubernetes pod log, every database query – has to travel from your infrastructure to Splunk’s platform. Splunk charges you to ingest it. The cloud provider charges you to egress it.&lt;/p&gt;

&lt;p&gt;When we looked at our AWS bill, we realized we were paying $45K a year in egress fees just to move logs to Splunk. That expense lived on a different spreadsheet. It was invisible to our security team.&lt;/p&gt;

&lt;p&gt;We were paying twice: once to move the data, once to store it.&lt;/p&gt;

&lt;p&gt;In the new world, we don’t move logs. We compress them and drop them into an S3 bucket in the same region as our workload. Egress cost: $0.&lt;/p&gt;

&lt;p&gt;We Started Compressing Differently&lt;br&gt;
Everyone compresses logs. But not like this.&lt;/p&gt;

&lt;p&gt;Standard compression (gzip, zstd) treats logs as a blob of text. It’s okay — you get 3× to 5× reduction.&lt;/p&gt;

&lt;p&gt;Property-aware compression understands what’s inside the log:&lt;/p&gt;

&lt;p&gt;json&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
  "timestamp": "2024-09-02T14:30:00Z",&lt;br&gt;
  "service": "auth-service",&lt;br&gt;
  "level": "INFO",&lt;br&gt;
  "message": "User logged in",&lt;br&gt;
  "user_id": "u-12345",&lt;br&gt;
  "ip": "10.0.0.1"&lt;br&gt;
}&lt;br&gt;
It knows:&lt;/p&gt;

&lt;p&gt;timestamp is a predictable sequence&lt;br&gt;
service repeats with low entropy&lt;br&gt;
level repeats even more&lt;br&gt;
user_id and ip fields are structured&lt;br&gt;
Instead of compressing the JSON as text, it compresses each field separately, using the optimal algorithm for that data type.&lt;/p&gt;

&lt;p&gt;The result is 50× to 100× compression versus raw storage. Not 3×. Not 5×. 50× or more.&lt;/p&gt;

&lt;p&gt;Suddenly, storing a year’s worth of security logs costs pennies instead of six figures.&lt;/p&gt;

&lt;p&gt;We Asked a Different Question&lt;br&gt;
When I was costing out Splunk, I asked:&lt;/p&gt;

&lt;p&gt;“What’s the cheapest way to get what we need?”&lt;/p&gt;

&lt;p&gt;The conversation was always about cutting — turning off log sources, filtering events before they get sent, sampling high-volume streams.&lt;/p&gt;

&lt;p&gt;“Do we really need DEBUG logs? Do we need all audit events?”&lt;/p&gt;

&lt;p&gt;That question made everyone nervous. Security didn’t want gaps in coverage. Compliance couldn’t risk audit failures. But finance was pushing hard.&lt;/p&gt;

&lt;p&gt;This time, I asked:&lt;/p&gt;

&lt;p&gt;“What if we could keep 100% of our logs, but store them for 90% less?”&lt;/p&gt;

&lt;p&gt;Suddenly, the conversation changed.&lt;/p&gt;

&lt;p&gt;The Switch Was Less Scary Than We Thought&lt;br&gt;
So here’s what moving off Splunk actually looked like, timeline included:&lt;/p&gt;

&lt;p&gt;Day 1–7: Parallel deployment. We set up a new BYOC SIEM platform in our own AWS account. Redirected logs to both Splunk and the new platform at the same time.&lt;/p&gt;

&lt;p&gt;Day 8–14: Validation. Ran identical queries in both systems, compared results row by row. Built dashboards to alert us if logs diverged.&lt;/p&gt;

&lt;p&gt;Day 15–28: Feature parity. Rebuilt our critical alerts ('failed login spike', 'unusual data export', 'privilege escalation attempt') in the new system. Recreated compliance dashboards for SOC2 and PCI-DSS.&lt;/p&gt;

&lt;p&gt;Day 29–35: Cutover. Shut off new logs to Splunk. Left the old data to expire naturally (90-day retention). Started routing everything to BYOC.&lt;/p&gt;

&lt;p&gt;Day 36 onward: We have everything Splunk gave us: log search, alerting, dashboards, correlation, compliance exports – at &amp;lt;10% the cost.&lt;/p&gt;

&lt;p&gt;The Math That Convinced Our CFO&lt;br&gt;
Here’s the three-year comparison that ended the finance vs. security tension for us.&lt;/p&gt;

&lt;p&gt;Cost Category   Splunk + AWS Fees   BYOC + AWS Fees&lt;br&gt;
Splunk licensing (100 GB/day)   $560K – $750K/year    $0&lt;br&gt;
AWS egress fees $45K/year   $0&lt;br&gt;
AWS compute/storage Included in Splunk infra    $45K/year&lt;br&gt;
Professional services (config/tuning)   $30K/year   $5K/year (one-time)&lt;br&gt;
Annual Total    $635K – $825K $50K – $55K&lt;br&gt;
3-Year Total    $1.9M – $2.47M    $150K – $165K&lt;br&gt;
Don’t take my word for it. Here’s how to check it yourself:&lt;/p&gt;

&lt;p&gt;Grab your Splunk contact’s per-GB/day rate. Multiply by your daily GB ingested.&lt;br&gt;
Look for “AWS Data Transfer” on your cloud bill – filter by Splunk IP ranges.&lt;br&gt;
Add your Splunk professional services spend (config tuning, updates, new data sources).&lt;br&gt;
Multiply by 3 years.&lt;br&gt;
If you’re like 95% of regulated teams, you will find a 6-figure bill – and a conscious choice to either accept it, or start cutting logs.&lt;/p&gt;

&lt;p&gt;What About Our Existing Skills?&lt;br&gt;
Our security analysts knew Splunk’s SPL (Search Processing Language). Splunk’s query language looks like this:&lt;/p&gt;

&lt;p&gt;index=firewall src_ip=10.0.0.1 | stats count by dest_port&lt;/p&gt;

&lt;p&gt;Modern BYOC platforms intentionally use familiar SQL-like syntax:&lt;/p&gt;

&lt;p&gt;SELECT dest_port, COUNT(*) FROM firewall WHERE src_ip = '10.0.0.1' GROUP BY dest_port&lt;/p&gt;

&lt;p&gt;The training curve was measured in hours, not weeks. Our analysts adjusted.&lt;/p&gt;

&lt;p&gt;We also kept our dashboards. Here’s one we rebuilt for AWS CloudTrail monitoring:&lt;/p&gt;

&lt;p&gt;sql&lt;/p&gt;

&lt;p&gt;SELECT&lt;br&gt;
  userIdentity.arn,&lt;br&gt;
  COUNT(*) AS event_count&lt;br&gt;
FROM cloudtrail_logs&lt;br&gt;
WHERE&lt;br&gt;
  eventTime &amp;gt;= NOW() - INTERVAL '1' HOUR&lt;br&gt;
  AND errorCode IS NOT NULL&lt;br&gt;
GROUP BY userIdentity.arn&lt;br&gt;
ORDER BY event_count DESC&lt;br&gt;
Same alerting logic, same visualizations, same RCA workflow – just fewer zeroes on the invoice.&lt;/p&gt;

&lt;p&gt;The Compliance Layer Nobody Talks About&lt;br&gt;
Running a regulated workload changes the SIEM conversation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Our Splunk environment:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used Splunk Cloud’s FedRAMP-authorized tenant&lt;br&gt;
Charged us 40% more for the compliance tier&lt;br&gt;
Limited our administrator access&lt;br&gt;
Required Splunk employees (with Splunk credentials) to perform maintenance&lt;br&gt;
Our BYOC environment:&lt;/p&gt;

&lt;p&gt;Runs in AWS GovCloud (already FedRAMP authorized)&lt;br&gt;
Costs the same as commercial AWS&lt;br&gt;
Gives us full admin control&lt;br&gt;
Keeps all access within our identity provider (Okta)&lt;br&gt;
Allows us to encrypt logs with our own KMS keys, and control who can decrypt&lt;br&gt;
When the auditor asks “who can read these logs?” we point to an IAM role and an Okta group. Not a Splunk support FAQ.&lt;/p&gt;

&lt;p&gt;The Uncomfortable Truth Nobody Wants to Say&lt;br&gt;
Spending $650K on Splunk is not an engineering failure. It’s a historical artifact.&lt;/p&gt;

&lt;p&gt;Splunk was invented when “big data” meant gigabytes, not terabytes. Its pricing model made perfect sense – charge per GB, because storage and compute were expensive, and indexing needed dedicated infrastructure.&lt;/p&gt;

&lt;p&gt;But in 2025:&lt;/p&gt;

&lt;p&gt;S3 storage costs $0.023/GB/month&lt;br&gt;
Serverless query engines (Trino, Presto) scan terabytes in seconds&lt;br&gt;
Compression algorithms can achieve 100× ratios on structured logs&lt;br&gt;
Kubernetes makes deploying distributed platforms a Terraform apply away&lt;br&gt;
We’re not paying for Splunk’s technology anymore. We’re paying for Splunk’s 2003 pricing model. We’re paying for Splunk’s 40% FedRAMP premiums. We’re paying for Splunk’s shareholder returns.&lt;/p&gt;

&lt;p&gt;That’s a choice. It’s not a law.&lt;/p&gt;

&lt;p&gt;Questions Our Team Asked Before Switching&lt;br&gt;
Q: What if we lose logs during migration? A: We ran both platforms side-by-side for four weeks. If logs diverged, alarms fired. They didn’t.&lt;/p&gt;

&lt;p&gt;Q: What about historical Splunk data? A: We left it to expire naturally (we had 90-day hot retention). Could have exported it, but the migration cost wasn’t worth it for old logs.&lt;/p&gt;

&lt;p&gt;Q: How do we handle incidents without Splunk’s security apps? A: We rebuilt our critical use cases natively. Turns out we didn’t need 90% of the apps – we built the 10% that mattered.&lt;/p&gt;

&lt;p&gt;Q: What if this new platform can’t scale? A: It runs in our AWS account. We scale the underlying infrastructure with our workload – horizontal scaling is built into the architecture.&lt;/p&gt;

&lt;p&gt;Q: Is this secure enough for our threat model? A: More secure. Logs never leave our cloud boundary. They’re encrypted with our KMS keys. We control all access policies.&lt;/p&gt;

&lt;p&gt;The Bottom Line&lt;br&gt;
We use a BYOC SIEM now because:&lt;/p&gt;

&lt;p&gt;It costs 90% less&lt;br&gt;
We own the data, the keys, the access controls&lt;br&gt;
We can prove to auditors exactly who can and cannot read logs&lt;br&gt;
We keep 100% of our logs – no sampling, no filtering, no gaps&lt;br&gt;
We don’t use it because Splunk is “bad.” We use it because the economics of SIEM changed, and we changed with them.&lt;/p&gt;

&lt;p&gt;If your Splunk bill is starting to look like a mortgage payment, the conversation is worth having. Start with a simple question at your next team sync:&lt;/p&gt;

&lt;p&gt;“If we were building our security monitoring from scratch today, with everything we know now about cost, compliance, and threats – what would we build?”&lt;/p&gt;

&lt;p&gt;Would you choose Splunk again?&lt;/p&gt;

&lt;p&gt;Our team didn’t.&lt;/p&gt;

&lt;p&gt;Further Reading&lt;br&gt;
Splunk's Ingestion Pricing Model &lt;br&gt;
Lossless vs. Gzip for Logs &lt;br&gt;
AWS Egress Costs &lt;/p&gt;

&lt;p&gt;Let’s Talk&lt;br&gt;
Drop your Splunk story in the comments. How big is your bill this year? Are you cutting logs to save money? I’m reading every one.&lt;/p&gt;

</description>
      <category>splunk</category>
      <category>siem</category>
      <category>security</category>
      <category>observability</category>
    </item>
  </channel>
</rss>
