pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPg_logical without subscription. Can we log the operations ?
2+ messages / 2 participants
[nested] [flat]
* Pg_logical without subscription. Can we log the operations ?
@ 2018-10-09 22:45 Dilshan <dilshanjsha@gmail.com>
2018-10-10 10:33 ` Re: Pg_logical without subscription. Can we log the operations ? Steve Atkins <steve@blighty.com>
0 siblings, 1 reply; 2+ messages in thread
From: Dilshan @ 2018-10-09 22:45 UTC (permalink / raw)
To: pgsql-general
Hi Team,
I am working on a requirement, where I need to log each and every
operation on the master db. So I was thinking if I could do with pg_logical
by setting my master db as publisher and setting a new db as subscriber and
dropping the subscription there after. I am wondering, how to get the
operations that a subscription would receive just into logs. Could you
guide me on that? Otherwise is there a possibility to receive all the
operation without dropping subscription and logging the details and
deleting the subscription tables to save space. I am planning to have logs
rotated and purging logs every month. Could you please guide me about the
possibility of this approach?
Thanks in advance,
Dilshan
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Pg_logical without subscription. Can we log the operations ?
2018-10-09 22:45 Pg_logical without subscription. Can we log the operations ? Dilshan <dilshanjsha@gmail.com>
@ 2018-10-10 10:33 ` Steve Atkins <steve@blighty.com>
0 siblings, 0 replies; 2+ messages in thread
From: Steve Atkins @ 2018-10-10 10:33 UTC (permalink / raw)
To: pgsql-general
> On Oct 9, 2018, at 11:45 PM, Dilshan <dilshanjsha@gmail.com> wrote:
>
> Hi Team,
> I am working on a requirement, where I need to log each and every operation on the master db. So I was thinking if I could do with pg_logical by setting my master db as publisher and setting a new db as subscriber and dropping the subscription there after. I am wondering, how to get the operations that a subscription would receive just into logs. Could you guide me on that? Otherwise is there a possibility to receive all the operation without dropping subscription and logging the details and deleting the subscription tables to save space. I am planning to have logs rotated and purging logs every month. Could you please guide me about the possibility of this approach?
You can read the logical replication stream with clients other than postgresql, and you can use plugins to format it in different ways.
https://wiki.postgresql.org/wiki/Logical_Decoding_Plugins has some of the third-party plugins to format the changes.
There are libraries for most languages to consume the logical decoding stream, or the included client "pg_recvlogical" can be used to write it to disk.
pg_recvlogical + wal2json might be the simplest way to do a basic audit trail.
Cheers,
Steve
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-10-10 10:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 22:45 Pg_logical without subscription. Can we log the operations ? Dilshan <dilshanjsha@gmail.com>
2018-10-10 10:33 ` Steve Atkins <steve@blighty.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox