Adding environment tags to Datadog Log Drains

Last updated: October 29, 2025

You can add custom tags to your Datadog Log Drains to differentiate between environments (such as staging and production) by including query string parameters in your Datadog destination URL.

How to add tags

When creating or updating your Datadog Log Drain, use the following URL format:

https://http-intake.logs.datadoghq.com/v1/input/YOUR_API_KEY?env=staging&custom_tag=value

Replace YOUR_API_KEY with your actual Datadog API key, and add any tags you need using the query string format tag_name=tag_value. Multiple tags can be separated with &.

(Note that ror Datadog Site US1, the base URL must be in the format of https://http-intake.logs.datadoghq.com/v1/input/DD_API_KEY. For other sites and more options, refer to https://docs.datadoghq.com/logs/log_collection.)

Example

For a staging environment, your URL might look like:

https://http-intake.logs.datadoghq.com/v1/input/abc123def456?env=staging&team=backend

For a production environment:

https://http-intake.logs.datadoghq.com/v1/input/abc123def456?env=production&team=backend

Important notes

  • You'll need to recreate your Log Drain with the updated URL that includes the query parameters

  • The tags will appear in Datadog and can be used for filtering and organizing your logs

  • This method works with the native Aptible Datadog Log Drain feature