Heroku’s Platform-as-a-Service model runs as well as configures your host. Many of the regular configuration options in the PHP Agent aren’t available in Heroku, so this should help troubleshoot or configure the agent in your Heroku environment.
Normally, the logs for the PHP Agent are found at
/var/log/newrelic/, but Heroku routes all logs to
STDERR. You can gather logs with Heroku with the following commands:
heroku logs -t | tee newrelic.log
heroku logs -t > newrelic.txt
Please note, these commands print out new log entires, therefore it won’t capture events that occurred before the command was written. You will also see all Heroku logs, and not just New Relic related entries.
Restarting the Daemon
Instead of restarting the daemon or restarting your PHP dispatcher after any config changes are made, you’d rebuild your slug in Heroku. Every time you push your repo, the slug compiler will rebuild from the buildpack. If the daemon disappears and the application stops reporting data you can rebuild your slug.
If pushing an empty commit isn’t something you’d like to do, you can use the Heroku repo tool.
The most common way to configure the PHP agent on Heroku is to set environment variables, either by using the Heroku CLI:
heroku config:set NEW_RELIC_LOG_LEVEL=verbosedebug
or by setting them manually via the web interface, found under Settings > Config Variables
The following environment variables are used by the buildpack when building the
All other settings will need to be set either uploading a custom configuration file named
.user.ini , or pointing
NEW_RELIC_CONFIG_FILE at another file in the repo.
If there are any custom settings that need to be added or modified, it is best to add them in a per directory
.user.ini file. In the standard Heroku buildpack, any settings in this file will be automatically copied to
Note: If your root directory’s git repository is also the root directory of your website, any files placed in this directory will also be served up by default. Therefore setting up a
newrelic.ini and pointing
NEW_RELIC_CONFIG_FILE isn’t advised.
If you just installed the agent with Heroku Pipelines but aren’t seeing it in the APM UI, please be sure to install the add-on to your staging app, NOT your production one. Once added, the New Relic add on should move between pipelines when getting promoted to a production or development app.
If you’re still not able to see your application in the APM UI if it’s been installed on your staging application, it may be worth contacting Heroku support. There aren’t any configuration changes going on with New Relic during these steps, so we wouldn’t have further insight on what to look into next.