Skip to content

Files

Latest commit

 

History

History
 
 

traefik

Traefik Integration

Overview

Send Traefik metrics, logs, and traces to Datadog to monitor your Traefik services.

Setup

The Traefik check is not included in the Datadog Agent package, so you need to install it.

Installation

For Agent v7.21+ / v6.21+, follow the instructions below to install the Traefik check on your host. See Use Community Integrations to install with the Docker Agent or earlier versions of the Agent.

  1. Run the following command to install the Agent integration:

    datadog-agent integration install -t datadog-traefik==<INTEGRATION_VERSION>
  2. Configure your integration similar to core integrations.

Configuration

About v2

For information about the changes from v1 to v2, see the Traefik migration guide. For information about the latest version, see the Traefik documentation.

Metric collection

Follow Traefik's documentation to send Traefik metrics to Datadog.

Log collection

Available for Agent >6.0

By default, Traefik logs are sent to stdout. This should not be changed for containerized version, because the Datadog Agent can collect logs directly from the container stdout/stderr.

  1. To configure Traefik to log to a file, add the following in the Traefik configuration file:

    [traefikLog]
      filePath = "/path/to/traefik.log"
      format   = "json"
    

    The common Apache Access format is used by default and is supported by this integration.

  2. Collecting logs is disabled by default in the Datadog Agent. Enable it in your datadog.yaml file with:

    logs_enabled: true
  3. Add this configuration block to your traefik.d/conf.yaml file at the root of your Agent's configuration directory to start collecting your Traefik logs:

    logs:
      - type: file
        path: /path/to/traefik.log
        source: traefik
        service: traefik

    Change the path and service parameter values and configure them for your environment.

  4. Restart the Agent

Trace collection

  1. Enable APM for Datadog, if needed.
  2. Follow Traefik's documentation to send traces to Datadog.

About v1

See Traefik documentation for information about v1. For information about the changes from v1 to v2, see the Traefik migration guide.

Metric collection

  1. To collect Traefik metrics, open the traefik.d/conf.yaml file in the conf.d/ folder at the root of your Agent's configuration directory.

  2. Add this configuration setup to your traefik.d/conf.yaml file to start gathering your metrics:

    init_config:
    
    instances:
      - host: 10.1.2.3
        port: "8080"
        path: "/health"
        scheme: "http"

    Configuration Options:

    • host: Traefik endpoint to query. Required
    • port: API listener of Traefik endpoint. Default value 8080. Optional
    • path: Path of Traefik health check endpoint. Default /health. Optional
    • scheme: Scheme of Traefik health check endpoint. Default http. Optional
  3. Restart the Agent to begin sending Traefik metrics to Datadog.

See the sample traefik.d/conf.yaml for all available configuration options.

Log collection

Available for Agent >6.0

By default, Traefik logs are sent to stdout. This should not be changed for containerized version, as the Datadog Agent is able to collect logs directly from container stdout/stderr.

  1. To configure Traefik to log to a file, add the following in the Traefik configuration file:

    [traefikLog]
      filePath = "/path/to/traefik.log"
      format   = "json"
    

    The common Apache Access format is used by default and is supported by this integration.

  2. Collecting logs is disabled by default in the Datadog Agent. Enable it in your datadog.yaml file with:

    logs_enabled: true
  3. Add this configuration block to your traefik.d/conf.yaml file at the root of your Agent's configuration directory to start collecting your Traefik logs:

    logs:
      - type: file
        path: /path/to/traefik.log
        source: traefik
        service: traefik

    Change the path and service parameter values and configure them for your environment.

  4. Restart the Agent

Trace collection

Available for Traefik v1.7+

  1. Enable APM for Datadog, if needed.
  2. Follow Traefik's documentation to send traces to Datadog.

Validation

Run the Agent's status subcommand and look for traefik under the Checks section.

Compatibility

The check is compatible with all major platforms.

Metrics

For v2, see the list of Traefik metrics sent to Datadog.

For v1, see the list of metrics provided by the integration.

Data Collected

Metrics

See metadata.csv for a list of metrics provided by this integration.

Events

The Traefik check does not include any events.

Service Checks

See service_checks.json for a list of service checks provided by this integration.

Troubleshooting

Need help? Contact Datadog support.