DEV Community

Cover image for I built this postgres logger
Kaushik Varanasi
Kaushik Varanasi

Posted on

1

I built this postgres logger

Postgres Logger

I used pgAudit to setup logging on my AWS RDS Postgres instance.

Disclaimer

I built (Rocketgraph)(https://rocketgraph.io/) which provides a complete backend. That includes Authentication, Hasura console for GraphQL, Postgres DB and serverless functions. So it let's you build web applications in minutes rather than in weeks.

see it in action

Image description

Try it out

Rocketgraph hosted

You can signup on Rocketgraph and create a project. The first project is free for 7 days and doesn't require CC.

This spins up a Postgres DB on AWS RDS instance with pgAudit configured.

Then, follow these steps to enable pgAudit:

Login to your RDS Postgres using psql like so:

psql postgresql://postgres:password@project-name.xxxxxxx.us-east-2.rds.amazonaws.com:5432/postgres
Enter fullscreen mode Exit fullscreen mode

Provided in your Rocketgraph dashboard

Create a role:

CREATE ROLE rds_pgaudit; 
Enter fullscreen mode Exit fullscreen mode

Then set log level:

ALTER DATABASE postgres set pgaudit.log="ALL"; 
Enter fullscreen mode Exit fullscreen mode

And enable extension:

CREATE EXTENSION pgAudit;
Enter fullscreen mode Exit fullscreen mode

self-hosted

To use pgAudit on your own Postgres instance, I wrote a detailed article here to setup: https://blog.rocketgraph.io/posts/install-pgaudit

Rocketgraph is open-source. Don't forget to star us here: https://github.com/RocketsGraphQL/rgraph

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay