-
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 & ~
-
Duplicate the above block for each log file, with
& ~
on a separate line each time. Restart rsyslog when you're done and don't forget to set up logrotation.
Last active
December 4, 2023 21:28
-
-
Save atrepca/7159195 to your computer and use it in GitHub Desktop.
Send Heroku logs to an rsyslog server and save them to separate files by application
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment