hash12
hash12

Reputation: 181

How can I log all Rails production console access on Heroku?

I would like to incorporate company policy into the Rails console so that any customer data being accessed via the console is logged and saved.

Ideally, whenever a developer opens up the console, it should ask him/her for the reason they are doing so along with the customer context if any, and then save any commands run in that session. This log should be stored somewhere and ideally land up in the Inbox of someone who monitors these things.

My question is if such a paradigm exists already on Heroku, and addon, or through a gem, or if not, some direction on how this can be implemented?

Upvotes: 2

Views: 305

Answers (2)

kg.
kg.

Reputation: 631

The archer gem can log Rails console activity to a database.

Upvotes: 0

Damien MATHIEU
Damien MATHIEU

Reputation: 32629

Heroku doesn't give you any way to do that automatically.
Consoles are code being executed though. So you could log the start of a bin/console wherever you want, and ask the person for their reason as the beginning of the session.

As mentioned by spickermann in the comments, people with push access would be able to override that. But Heroku logs all deployments. So if someone tried doing that, you'd know about it too.

Upvotes: 2

Related Questions