Issue
I want to get the logs for all the credentials created for my database including the default credential for audit purpose.
Resolution
There is no direct way or single query to get the history of the database credentials.
However, all the credentials rotation is always reflected in the app releases history (https://devcenter.heroku.com/articles/releases#listing-release-history) with their corresponding config var changes.
So, one may use something like:
heroku releases -n <last_n_releases -a <app_name> | grep -E '<database_name>|<COLOUR>'
For example,
heroku releases -n 100 âapp my-prod-app | grep -E 'postgresql-metric-73103|BRONZE|SILVER'
The above command would display last â100â releases for the âmy-prod-appâ app attached to the databases. You can add multiple database using Pipe(|).
Note: Not all the results displayed from the above is a result of credential rotations, most of them will be the effect of maintenances, but you could run heroku releases:info <RELEASE_NUMBER> to see the details and the credentials in each.