If your log data is already being monitored by Heroku's built-in Logplex router, you can use our integration to forward and enrich your log data in New Relic.
Forwarding your Heroku logs to New Relic will give you enhanced capabilities to collect, process, explore, query, and alert on your log data.
We currently support Heroku HTTPS drains and Heroku Syslog drains.
Using the Heroku HTTPS drains you will be able to add custom metadata to your logs. That way, you can set different attributes for each of your drains like the Application name or any other attribute you may need. Also, the whole process of registering new drains and deleting them is easier that with syslog.
Heroku Syslog drains on the counterpart doesn't allow you to add this custom metadata so it's harder to differentiate between the configured drains on the logs.
Heroku HTTPS drains
To configure this type of drain:
- Ensure you have the admin role.
- Go to the New Relic Marketplace.
- Under Logging, click the
Heroku
tile. You can also search for it using the search bar. - If you have multiple accounts, select the account to which you want to send the logs.
- Optional: Click Add metadata if you want to add custom metadata to the log drain and fill up the list with the key pairs you need.
- Give your application a name. You'll use it to find your data later.
- Copy the Heroku CLI command to your clipboard clicking the Copy to clipboard button.
- Go to your terminal in the directory where you have the Heroku CLI set up. If you’re using Windows VM, use the traditional command prompt instead of Git Bash.
- Run the command in your terminal.
- Optional: click Test for logs if you want to check if logs are reaching New Relic.
Heroku Syslog drains
We suggest you use Heroku HTTPS drains whenever possible as they're simple to install, remove and also allows adding custom attributes to your logs.
Create a Heroku Syslog drain
We recommend you use Heroku HTTPS drains because they're simple to set up and because they let you add attributes to your logs. But if you need to use a syslog drain, here's the procedure:
Ensure you have the Admin role.
Download and install the Heroku CLI.
Use the Heroku CLI to create a Syslog drain and attach it to the application you want to stream logs from, replacing
YOUR_APP_NAME
with the name of your Heroku application.bash$heroku drains:add syslog+tls://newrelic.syslog.nr-data.net:6515 -a YOUR_APP_NAMEIf you're located in Europe, run this command instead:
bash$heroku drains:add syslog+tls://newrelic.syslog.eu.nr-data.net:6515 -a YOUR_APP_NAMERun the following command and copy the Heroku Syslog drain token from the
token
attribute:bash$heroku drains -a YOUR_APP_NAME --json{"addon": null,"created_at": "2018-12-04T00:59:46Z","id": "906262a4-e151-45d2-b35a-a2dc0ea9e688","token": "d.f14da5dc-106b-468d-b1bd-bed0ed9fa1e7","updated_at": "2018-12-04T00:59:47Z","url": "syslog+tls://newrelic.syslog.nr-data.net:6515"}
Register a Heroku syslog drain
Next, you'll need to register your newly created Heroku Syslog drain in New Relic:
- Ensure you have the admin role.
- Go to the New Relic Marketplace.
- Under Logging, click the
Heroku (syslog)
tile. You can also search for it using the search bar. - If you have multiple accounts, select the account in which you want to register the drain token.
- Paste your newly created Heroku drain token in the Heroku drain token field.
- Click Add Heroku drain log to complete the registration.
Importante
Heroku currently doesn't support customizing the format of logs sent from Logplex. For more information, see Heroku's log format documentation.
Este documento ajudou você na instalação?
Delete a Heroku syslog drain token mapping
You can delete Heroku syslog drain token mapping either via the New Relic UI or via API.
To delete a Heroku syslog drain token mapping via the UI:
- Ensure you have the admin role.
- Go to the New Relic Marketplace.
- Under Logging, click the
Heroku (syslog)
tile. You can also search for it using the search bar. - If you have multiple accounts, select the account that contains the drain token mappings you wish to delete and click Continue. Otherwise, go to step 6.
- Find the drain token mapping you want to delete and click the vertical three-dot icon next it. Next, click Delete Heroku drain token.
- Your Heroku drain token mapping is deleted.
To delete a Heroku syslog drain token mapping via REST API:
Find or generate a .
Run the command below to retrieve a list of Heroku drain token mappings from your New Relic account, making sure to update values for
YOUR_NR_LICENSE_KEY
andYOUR_NR_ACCOUNT_ID
:bash$curl -H 'api-key: YOUR_NR_LICENSE_KEY' https://log-syslog-configuration-api.service.newrelic.com/heroku-account-mappings?accountId=YOUR_NR_ACCOUNT_IDThe formatted result looks something like this:
[{"herokuMappingId": 1549,"drainToken": "YOUR_DRAIN_TOKEN","nrApiInsertKey": "YOUR_DRAIN_TOKEN_NR_API_KEY","createdAt": "2022-05-13T07:47:23","createdBy": "YOUR_EMAIL_ADDRESS"}]You need the
herokuMappingId
for each drain token that you want to remove.To delete a drain token, run the command below. Make sure to update values for
YOUR_NR_LICENSE_KEY
,YOUR_NR_ACCOUNT_ID
, and theherokuMappingId
you retrieved in the last step:bash$curl -X DELETE -H 'api-key: YOUR_NR_LICENSE_KEY' https://log-syslog-configuration-api.service.newrelic.com/heroku-account-mappings/<herokuMappingId>?accountId=YOUR_NR_ACCOUNT_ID
When you're done, the API returns an HTTP 204 response and the drain token mapping is deleted.
View log data
If everything is configured correctly and your data is being collected, you should see data logs in both of these places:
- Our logs UI
- New Relic tools for running NRQL queries. For example, you can execute a query like this:
SELECT * FROM Log
If no data appears after you enable our log management capabilities, follow our standard log troubleshooting procedures.
What's next?
- Explore logging data across your platform with our logs UI.
- Get deeper visibility into both your application and your platform performance data by forwarding your logs with our logs in context capabilities.
- Set up alerts.
- Query your data and create dashboards.
Disable log forwarding
To disable log forwarding capabilities, follow standard procedures in Heroku Syslog documentation. You do not need to do anything else in New Relic.