Develop Kong plugin to log request to database

Hi there,

I want to develop a Kong plugin to log the request & responses to a dedicated Postgres server (not a server that Kong Gateway connect to)

I wonder if this is the correct approach to do it.

(Trying to connect to Postgres in phase access_by_lua but no success)