Prompt
What should I use for event-driven microservices and audit logs?
Latest observation
Oct 24, 2026
OpenAI APIWeb search: off
For event-driven microservices and audit logs, the best choice is usually:
1) Event streaming backbone
Use Apache Kafka if you want a durable, scalable event log for microservices.
Why Kafka:
- Strong fit for event-driven architecture
- Handles high throughput
- Supports replayability of events
- Good for decoupling services
- Works well with CQRS, outbox pattern, and change-data-capture
Good alternatives:
- RabbitMQ: better for traditional messaging/work queues, less ideal as an event log
- NATS: lightweight, very fast, simpler operationally
- Pulsar: strong multi-tenancy and tiered storage; good if you need advanced scaling/storage options
2) Audit log storage
For audit logs, don’t rely only on the broker. Store them in a persistent, queryable, immutable-ish datastore.
Good options:
- PostgreSQL if you want relational querying and strong consistency
- OpenSearch / Elasticsearch if you need fast search and filtering
- Object storage like S3/Blob storage for cheap long-term retention
- Append-only log store if you need strong immutability/compliance guarantees
Best practice:
- Publish domain events to Kafka
- Consume them into an audit log sink
- Keep audit records append-only
- Include:
- who did it
- what changed
- when
- correlation/request ID
- before/after state if needed
- source service/version
Recommended practical stack
If you want a common, solid setup:
- Kafka for service events
- PostgreSQL for structured audit trail
- OpenSearch for searching audit records
- S3 for long-term archival/retention
Important design note
For audit logs, prefer event sourcing or outbox pattern rather than logging from application code alone. That helps avoid missing events when transactions fail.
If you want, I can also recommend a stack based on your constraints like:
- cloud provider
- team size
- scale
- compliance needs
- budget