Closed Eeyurrn closed 5 days ago
This seems to have been resolved with #11181. However, 2 things to note:
https://http-intake.logs.datadoghq.com/api/v2/logs
)env
I have to do it with "@" prefixed, eg @env:
instead of env:
, and I can't group log monitors by env
. It's not seen as a tag but as an attribute, if I understand correctly.Looking at the Logs API Send Logs endpoint it seems to expect ddtags
instead of explicitly passing env
.
What it says in the documentation to do:
heroku drains:add 'https://http-intake.logs.datadoghq.com/api/v2/logs/?dd-api-key=<DD_API_KEY>&ddsource=heroku&env=<ENV>&service=<SERVICE>&host=<HOST>' -a <APPLICATION_NAME>
What it probably should be:
heroku drains:add 'https://http-intake.logs.datadoghq.com/api/v2/logs/?dd-api-key=<DD_API_KEY>&ddsource=heroku&ddtags=env:<ENV>&service=<SERVICE>&host=<HOST>' -a <APPLICATION_NAME>
Not sure about host
but in the API docs it has hostname
so that may need to change as well.
service
, ddsource
, and dd-api-key
are working correctly for me.
@sarina-dd Do you have any insights into this since you worked on the PR mentioned above last year?
In my case, https://docs.datadoghq.com/logs/guide/collect-heroku-logs/ didn't show the correct region of my account.
Ex.
heroku drains:add "https://http-intake.logs.datadoghq.com/api/v2/logs?dd-api-key=<DD_API_KEY>&ddsource=heroku&env=<ENV>&service=<SERVICE>&host=<HOST>" -a <APPLICATION_NAME>
The above instruction is for us1
region. If you use the different region like eu
, you should use the following:
heroku drains:add "https://http-intake.logs.datadoghq.eu/api/v2/logs?dd-api-key=<DD_API_KEY>&ddsource=heroku&env=<ENV>&service=<SERVICE>&host=<HOST>" -a <APPLICATION_NAME>
You can confirm that with pull-down of sidebar.
Documentation Page
https://docs.datadoghq.com/logs/guide/collect-heroku-logs/
Issue Description
I was trying to set up logging on a new environment for our app to fully transition off of an old provider.
I needed to set the env so I could view the logs and filter them by environment.
Our app runs on Heroku.
This page could be more explicit on how to set the
env
for a given application.What I've discovered is that setting the
env
via the log drain is the only way to set theenv
(at least for logging in a Heroku application).For example:
Other things which I tried, had no effect, such as:
DD_ENV
env variableDD_TAGS='env:my-env'
I would suggest something like
A better explanation of how logs are set up in Heroku can save hours for developers trying to setup Datadog for the first time.