GSM Hosting All articles
Server Administration

Delete With Confidence: Deciding What Your SMS Gateway Keeps and for How Long

GSM Hosting
Delete With Confidence: Deciding What Your SMS Gateway Keeps and for How Long

Photo: Federal Bureau of Investigation, Public domain, via Wikimedia Commons

Every SMS gateway is a slow-motion archive. Nobody sets out to warehouse three years of message bodies; it just accumulates, because deletion feels like the one operation you can't undo. So the tables grow, the backups grow, and one day a support ticket asks you to pull the full text of a message from March 2023 — and you can, which is precisely the problem.

A retention policy is not a storage optimization exercise. It's a statement about what you're willing to be responsible for. Here's a framework that fits a US operator running a modem farm or an SMPP gateway without a compliance department.

Sort the data before you pick a number

Retention debates go sideways because people argue about 'message logs' as one thing. They're at least five:

  1. Operational telemetry — bind state, queue depth, throughput counters, modem signal readings. Nobody's privacy is at stake, but it's voluminous.
  2. Routing metadata — who submitted, to which network, when, and what happened. This is your invoice reconciliation and dispute evidence.
  3. Message content — bodies, UDH, concatenation parts, and anything base64'd into a TLV because someone was in a hurry.
  4. Delivery receipts — the DLR trail, which proves the handset accepted it (or didn't).
  5. Consent and opt-out records — STOP replies, opt-in timestamps, campaign associations. This is the one category you keep longest, because it's your defense if a complaint lands.

Give each class its own window. One number for everything guarantees you either delete too much or keep too much.

Windows you can actually defend

Starting points that hold up in practice:

Write the reasoning next to each number. An auditor doesn't need you to be conservative, they need you to be consistent.

Redact at ingest, not at export

If content has to live in your system for 72 hours, it should live there in a form that's useless if the bucket leaks. Two moves cover most of it:

Do the redaction in the ingest path, not in a nightly job. A nightly job means the unredacted version existed somewhere for hours, and it means one failed cron run silently changes your policy.

Access controls that survive an audit

Retention is only half the story; the other half is who can read what's left.

Then log the reads, not just the writes. When someone asks whether a customer's message content was accessed, the answer should come from a table, not a memory.

Make deletion the default

Manual purges never happen. Partition by day, drop partitions on a schedule, and let the job be boring. For anything stored encrypted at rest, key destruction is a legitimate deletion method — the ciphertext remains, the plaintext is gone, and it's fast enough to run on a weekend.

Two guardrails so the drop job never becomes the incident:

Test the delete

Once a quarter, insert a canary record with an obvious marker, wait out the retention window, and confirm it's gone. Restore a backup and verify the canary isn't resurrected by a restore that predates the purge. That last part catches the most embarrassing failure mode: a policy that's followed in the primary database and quietly ignored in the backup chain.

The point of all this isn't to keep less data for its own sake. It's to be able to say, with a straight face, exactly what you hold, why, for how long, and who can see it. That sentence is worth more than any retention number you pick.

All Articles

Related Articles

The 3 A.M. Test: Drilling Your SMS Gateway Runbook Before It Drills You

The 3 A.M. Test: Drilling Your SMS Gateway Runbook Before It Drills You

Twelve Modems, One Hub, Zero Margin: A USB Health Audit for a Dense Rack

Twelve Modems, One Hub, Zero Margin: A USB Health Audit for a Dense Rack

Spares You Haven't Touched Aren't Spares: Running a Quarterly Fire Drill on Idle Modem Gear

Spares You Haven't Touched Aren't Spares: Running a Quarterly Fire Drill on Idle Modem Gear