Any recommendations on a good logging database? I like keeping full logs of what the application does (important for traceability in my case) and love how much effort has gone into postgres backups and querying and such.
Any recommendations on a good logging database? I like keeping full logs of what the application does (important for traceability in my case) and love how much effort has gone into postgres backups and querying and such.
Your log table will always be empty (so not taking up disk space), but the CDC tool will be able to get all the information from the TX logs (which themselves can be discarded after all replication slots have advanced a given offset). The advantage is that your log entries are transactionally written with the actual application data itself.
We use this technique for instance in the Debezium Quarkus extension for implementing the outbox pattern [1]. Postgres even allows you to insert records directly to the TX log via pg_logical_emit_message() - so no table involved at all -, but we don't support this in Debezium yet.
Disclaimer: I work on Debezium.
[1] https://debezium.io/documentation/reference/integrations/out...
Any chance JDK11 support will come for the Debezium Java core [1]?
Re SQLite, is there any CDC interface which could be used to implement a connector?
When the README listed Java 1.8 as a requirement, I assumed (perhaps incorrectly) an implication that it works with _only_ Java 1.8.
At my work, some critical libraries only work with Java 8 or 11, so the transition from 8 was challenging on the dependency versioning front. It's a gigantic project and codebase, though.
Re: SQLite, not that I know of, but I don't have deep knowledge on the matter. HN may go crazy (in a good way!) if there were a way to pull this off though!!!
For example, instead of inserting everything into a log table and deleting old entries and needing to vacuum things, use a partitioned table and just DROP entire partitions when they age out. You can summarize them into some kind of summary table before that, of course.
The partitions are good for the summaries too. Instead of doing index scans on the range of dates across a terabyte of logs, it is a full table scan on a partition of a single day or hour.
You can use a separate database for logging but the one time we did that it got weird. We ended up doing reporting scripts that had to first copy tables from the active DB to the logging DB so we could use them to JOIN on some log columns. They weren't huge but if everything had been in the same DB it wouldn't have been needed.
All of the scripts and procedures I know of were custom written for this. I don't know of any good prepackaged Postgres logging configs, but they may be out there.
[1] https://www.postgresql.org/docs/current/ddl-partitioning.htm...
[2] https://www.postgresql.org/docs/current/ddl-foreign-data.htm...
So far, I like it. You get a minimalist UI for doing interactive queries, and your data is ultimately persisted in your own Google BigQuery datasets so you can write arbitrary SQL against them.
I have yet to run significant volume through it, so perhaps my view will change if it performs worse at scale.
We're starting to explore it in production and it's looking very promising. Much, much simpler (especially to integrate) than ELK.
1. We insert the logs in the main database and periodically delete old logs. We can thus create the log in the same transaction as a record is created/updated/deleted. Yay atomicity!
2. The second database uses logical replication to receive new logs, but it only replicates INSERT operations so old logs are never deleted.
3. The application can show recent logs quickly (who updated the customer profile this week?) and if the user wants to dig deeper, we can query the slower log database but the user kind of expect that pulling the entire history of a record will take a bit longer than other operations.