Projects / rdstail
rdstail
v0.3 beta · Apache 2.0tail -f for AWS RDS logs, without CloudWatch in the middle.
A single static Go binary that streams PostgreSQL, MySQL and MariaDB log files straight from the RDS API to S3, Kafka, an HTTP webhook or stdout, with durable checkpoints and at-least-once delivery.
- 85–95% cheaper than the CloudWatch export path
- ~3.5s p50 end-to-end latency at a 5s poll
- 0 log lines dropped: failures park in a DLQ
- 1 static binary, one YAML file
Why I built it
If you run RDS and want your Postgres or MySQL error, slow-query and audit logs somewhere durable, AWS gives you one path: CloudWatch log export. You pay for ingestion, retention and export even if all you do is move the data elsewhere. Tail latency is minutes, and there is no native route to Kafka or a custom webhook.
At 100 GB of logs a month that is about $53 before you have moved anything to S3. rdstail calls the RDS log API directly, which AWS does not bill, compresses before the first byte is stored, and lands the same 100 GB in S3 for well under $10.
What it does
Zero-config tail
rdstail tail -i my-db --since 1h --grep "deadlock" follows a primary and its replicas together, with the engine auto-detected.
Fan out to every sink
S3 (NDJSON + gzip), Kafka (acks=all, idempotent), HTTP webhooks and stdout, all at once. Per-sink severity routing sends only ERROR+ to PagerDuty while S3 archives everything.
Tag-based discovery
Point a source at RDS tags and rdstail tracks fleet churn live: Terraform creates a tagged instance, a worker starts; the instance is destroyed, its worker stops.
DLQ with replay
Terminal sink failures are parked, never dropped. dlq replay re-delivers once the sink is fixed and deletes rows only after a durable ACK.
Ops tooling built in
init builds a config from your live account, iam-policy prints the least-privilege policy for your exact config, and cost-estimate prices your fleet against CloudWatch.
Compliance-ready
An audit-log archive pack for pgAudit and the MariaDB audit plugin into S3 Object Lock, with an evidence guide for SOC 2, PCI-DSS and HIPAA assessors.
How it works
- For each log file, read the last checkpoint and call DownloadDBLogFilePortion from that marker.
- Parse lines, stamp each with a deterministic BatchID = sha256(instance|file|prevMarker|nextMarker), and extract server-side timestamp and severity.
- Coalesce chunks into batches of up to 5 MiB and write them to the sinks. Each sink must ACK durably (S3 2xx, Kafka acks=all, HTTP 2xx).
- Only then advance the checkpoint. A crash between write and checkpoint causes at most one duplicate batch, which downstream can drop by BatchID.
RDS API ──► Fetcher ──► InstanceWorker ──► Sinks (retry → DLQ)
DescribeDBLogFiles │ after ACK ├─ S3
DownloadDBLogFilePortion ▼ ├─ Kafka
State (SQLite) └─ HTTP / stdout Engineering decisions
Correctness first
The design priorities are, in order, correctness, simplicity and cost. A chaos test verifies that everything delivered is a superset of the source under a 30% sink-flap rate, and the full suite runs race-enabled in CI.
RDS quirks, verified live
Tested against real RDS MySQL 8.4 and PostgreSQL 16: the 1 MB response cap that cuts lines mid-way, hourly MySQL rotation where the marker chain sticks after two rotations, and purged-hour gaps reported as anomalies.
Deliberately narrow
No UI, no alerting, no log parsing beyond timestamp and severity. rdstail moves logs reliably and leaves the rest to the tools you already run.
Try it
Tail an instance right now
brew install avinash-gupta-rdz/tap/rdstail
rdstail tail -i my-db-1 --region ap-south-1 --min-severity ERROR Ship to S3 continuously
rdstail init # wizard: pick instances + a sink
rdstail validate -c rdstail.yaml --deep
rdstail run -c rdstail.yaml Built with
- Go
- AWS SDK v2
- SQLite
- Kafka (franz-go)
- S3
- Prometheus