-
Add a Heroku drain for your app to forward the logs to your rsyslog server:
heroku drains:add --app my-prod-app syslog://logging01.prod.mydomain.net:514
-
List the drain you just created to get the unique Drain ID:
heroku drains -x --app my-prod-app
-
On the rsyslog server save the logs coming from Heroku to separate files, without duplicating to
/var/log/messages
(thanks to the& ~
). Create a/etc/rsyslog.d/90-heroku.conf
file containing:if $HOSTNAME startswith 'Drain_ID' then /opt/log/heroku/my-prod-app.log
& ~