Which are the options I have to create a structured log of all INSERT, UPDATE and DELETE from all tables of my PostgreSQL database? With MySql, I'm using replication api to record all changes from my database.
pymysqlreplication and https://github.com/nevill/zongji are what I'm using.
I wonder which are the options I have to do the same with PostgreSQL.
I'm looking for a simple solution, that doesn't depend on table schema or create trigger for every single table.
You would use logical decoding. You could choose an existing logical decoding plugin like wal2json, or you can write your own.
Note that you will only get data modifications that way, DDL statements won't be decoded. It is not absolutely required, but strange things can happen if your tables have no primary key.
If your goal is not to capture the changes but to log all statements that modify anything, set log_statement = 'ddl'.