'Writing logs on Stored Procedure and display them on Cloudwatch

I am implementing a DMS synchronization between an underlying database and a target database which is an Aurora Postgres. Every table in Aurora Postgres triggers a Stored Procedure that builds a payload to be sent to a Lambda function as parameter.

I would like to implement some mechanism of logging within the Stored Procedure for tracking not only the queries I perform there, but the payload that is built.

I know there is a flag in RDS for forwarding logs from Aurora RDS instances to Cloudwatch, but I consider It is not necessary to track all the ingestions made in Aurora. basically, I want to be able to track the Stored Procedure ONLY.

Is there any approach/good practise to achieve my goal?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source