> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sawmills.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How to send data from Datadog agent

> Configure the Datadog Agent to send logs and metrics to the Sawmills Collector using Helm or environment variables with single or dual shipping.

This guide provides instructions for configuring a Datadog agent to send telemetry data to the Sawmills Collector installed on a different Kubernetes cluster.
For instructions on configuring external access to the Sawmills Collector, please refer to [Configure the Sawmills Collector for External Access](/docs/send-data-to-collector).

***

## Prerequisites

* A **Datadog agent** installed in the source cluster.
* The **Sawmills Collector** deployed and accessible in the destination Kubernetes cluster.
* **Network connectivity** between the source and destination clusters.

> **Note:** Use the collector endpoint from your deployment. For in-cluster traffic, the endpoint usually looks like `<collector-service>.<namespace>.svc.cluster.local:<port>`. If the Sawmills collector load balancer is enabled, use the source-facing load balancer service.

***

## Supported Data Types

| Data Type | Supported | Notes                                                                         |
| :-------- | :-------- | :---------------------------------------------------------------------------- |
| Logs      | Yes       | All log formats                                                               |
| Metrics   | Yes       | Gauges, counts, rates, histograms, and distributions                          |
| Traces    | No        | Must be sent directly to Datadog (see [Traces](#traces-bypass-configuration)) |

<Warning>
  **Traces are not supported through the Sawmills Collector.** If your Datadog
  agent sends traces through Sawmills, that trace data will be lost. Make sure
  APM/tracing is configured to send directly to Datadog. See [Traces Bypass
  Configuration](#traces-bypass-configuration) for details.
</Warning>

***

## Logs Configuration

### Configuration Options

There are several ways to configure the Datadog agent to send log data to the Sawmills Collector. Choose the method that best fits your deployment:

* **Option 1**: Send only logs to Sawmills Collector (single shipping) - Configuration file method
* **Option 2**: Send only logs to Sawmills Collector (single shipping) - Environment variables method
* **Option 3**: Send logs to both Datadog and Sawmills Collector (dual shipping) - Environment variables method
* **Option 4**: Send logs to both Datadog and Sawmills Collector (dual shipping) - Configuration file method

### Configure the Datadog Agent for Logs

Before updating endpoints, make sure the Datadog Agent is collecting logs. The examples below include the required flags (`logs_enabled: true` or `DD_LOGS_ENABLED=true`) so the Agent actually ships log data to the Sawmills Collector.

#### Helm Chart Configuration

If you installed the Datadog agent using a Helm chart, add the following to your `values.yaml`:

```yaml theme={null}
datadog:
  logs:
    enabled: true
    containerCollectAll: true # optional, collects all container logs by default
agents:
  useConfigMap: true
  customAgentConfig:
    logs_config:
      use_http: true
      force_use_http: true
      logs_dd_url: <collector-service>.<namespace>.svc.cluster.local:<port>
      logs_no_ssl: true
```

#### Configuration File Method

**Option 1**: Configure sending only logs to Sawmills Collector (Single Shipping)

This approach sends only logs to the Sawmills Collector while keeping metrics and traces going to Datadog.

```yaml theme={null}
logs_enabled: true
logs_config:
  use_http: true
  force_use_http: true
  logs_dd_url: <collector-service>.<namespace>.svc.cluster.local:<port>
  logs_no_ssl: true
```

**Option 2**: Configure sending only logs to Sawmills Collector (Environment Variables Method)

This approach uses environment variables to configure single shipping, which is useful for containerized deployments or when you prefer environment-based configuration.

Set the following environment variables in your Datadog agent deployment:

```yaml theme={null}
- name: "DD_LOGS_ENABLED"
  value: "true"
- name: "DD_LOGS_CONFIG_FORCE_USE_HTTP"
  value: "true"
- name: "DD_LOGS_CONFIG_USE_HTTP"
  value: "true"
- name: "DD_LOGS_CONFIG_LOGS_DD_URL"
  value: "<collector-service>.<namespace>.svc.cluster.local:<port>"
- name: "DD_LOGS_CONFIG_LOGS_NO_SSL"
  value: "true"
```

**Option 3**: Configure dual shipping (Environment Variables Method)

This approach allows you to send logs to both Datadog and Sawmills Collector simultaneously using environment variables.

Set the following environment variables in your Datadog agent deployment:

```yaml theme={null}
- name: "DD_LOGS_ENABLED"
  value: "true"
- name: "DD_LOGS_CONFIG_FORCE_USE_HTTP"
  value: "true"
- name: "DD_LOGS_CONFIG_USE_HTTP"
  value: "true"
- name: "DD_LOGS_CONFIG_LOGS_NO_SSL"
  value: "true"
- name: "DD_LOGS_CONFIG_ADDITIONAL_ENDPOINTS"
  value: '[{"api_key": "ignore", "host": "<collector-service>.<namespace>.svc.cluster.local", "port": <port>, "is_reliable": true}]'
```

**Option 4**: Configure dual shipping (Configuration File Method)

This approach allows you to send logs to both Datadog and Sawmills Collector simultaneously.

Add the following `additional_endpoints` section to your configuration:

```yaml theme={null}
logs_enabled: true
logs_config:
  use_http: true # ensures both primary and additional endpoints use HTTP transport
  force_use_http: true # this is important to force the agent to use http
  logs_no_ssl: true
  additional_endpoints:
    - api_key: ignore
      host: <collector-service>.<namespace>.svc.cluster.local
      port: <port>
      use_ssl: false
```

> **Warning:** Different Datadog agent versions might have slightly different ways of configuring the agent. If you can't manage to disable HTTPS, try using `dev_mode_no_ssl: true` under logs\_config.

> **Note:** Adjust `<collector-service>.<namespace>.svc.cluster.local:<port>` to match the domain and port you configured in the Sawmills Collector's external access setup.

***

## Metrics Configuration

The Sawmills Collector supports Datadog metric series ingestion for **gauges**, **counts**, **rates**, and **histograms** through the Datadog metrics API-compatible endpoints. The `DD_DD_URL` environment variable controls where the agent sends metric data.

<Warning>
  The Datadog distributions endpoint `/api/v1/distribution_points` is not
  currently supported by the Sawmills Collector.
</Warning>

### Configuration Options

* **Option 1**: Send only metrics to Sawmills Collector (single shipping)
* **Option 2**: Send metrics to both Datadog and Sawmills Collector (dual shipping)

### Option 1: Single Shipping (Environment Variables)

This approach redirects all metric data to the Sawmills Collector. Metrics will no longer be sent directly to Datadog.

```yaml theme={null}
- name: "DD_DD_URL"
  value: "http://<collector-service>.<namespace>.svc.cluster.local:<port>"
- name: "DD_USE_V2_API_SERIES"
  value: "true"
```

Using a configuration file:

```yaml theme={null}
dd_url: http://<collector-service>.<namespace>.svc.cluster.local:<port>
use_v2_api.series: true
```

### Option 2: Dual Shipping (Environment Variables)

This approach sends metrics to both Datadog and the Sawmills Collector simultaneously.

```yaml theme={null}
- name: "DD_USE_V2_API_SERIES"
  value: "true"
- name: "DD_ADDITIONAL_ENDPOINTS"
  value: '{"http://<collector-service>.<namespace>.svc.cluster.local:<port>": ["ignore"]}'
```

Using a configuration file:

```yaml theme={null}
use_v2_api.series: true
additional_endpoints:
  "http://<collector-service>.<namespace>.svc.cluster.local:<port>":
    - ignore
```

<Note>
  The default port for the Datadog metrics source in the Sawmills Collector is
  **8126**. Make sure the port in your configuration matches the port configured
  in your [Datadog Source](/docs/source-datadog).
</Note>

### Helm Chart Configuration (Metrics)

To configure metrics forwarding via Helm, add the following to your `values.yaml`:

```yaml theme={null}
datadog:
  dd_url: http://<collector-service>.<namespace>.svc.cluster.local:<port>
agents:
  containers:
    agent:
      env:
        - name: "DD_USE_V2_API_SERIES"
          value: "true"
```

For dual shipping with Helm:

```yaml theme={null}
agents:
  containers:
    agent:
      env:
        - name: "DD_USE_V2_API_SERIES"
          value: "true"
        - name: "DD_ADDITIONAL_ENDPOINTS"
          value: '{"http://<collector-service>.<namespace>.svc.cluster.local:<port>": ["ignore"]}'
```

***

## Traces Bypass Configuration

<Warning>
  **Traces are not supported through the Sawmills Collector.** You must ensure
  that APM/trace data continues to be sent directly to Datadog. If trace data is
  routed through Sawmills, it will be dropped and **you will lose trace data**.
</Warning>

When configuring the Datadog agent to send logs and/or metrics through Sawmills, make sure traces are **not** redirected. The APM endpoint is controlled independently from logs and metrics:

* **Do not** set `DD_APM_DD_URL` to the Sawmills Collector address.
* **Do not** set `DD_TRACE_DD_URL` to the Sawmills Collector address.
* If you are using `DD_DD_URL` for metrics single shipping, APM will continue to send traces directly to Datadog as long as `DD_APM_DD_URL` is not explicitly overridden.

To explicitly ensure traces go directly to Datadog, you can set:

```yaml theme={null}
- name: "DD_APM_ENABLED"
  value: "true"
- name: "DD_APM_DD_URL"
  value: "https://trace.agent.datadoghq.com"
```

<Note>
  Replace `datadoghq.com` with your Datadog site (e.g., `us5.datadoghq.com`,
  `datadoghq.eu`) if you are not on the US1 site.
</Note>

***

## Combined Configuration Example

Below is a complete example that sends **both logs and metrics** through the Sawmills Collector while keeping **traces going directly to Datadog**:

### Environment Variables

```yaml theme={null}
# Logs → Sawmills Collector
- name: "DD_LOGS_ENABLED"
  value: "true"
- name: "DD_LOGS_CONFIG_FORCE_USE_HTTP"
  value: "true"
- name: "DD_LOGS_CONFIG_USE_HTTP"
  value: "true"
- name: "DD_LOGS_CONFIG_LOGS_DD_URL"
  value: "<collector-service>.<namespace>.svc.cluster.local:<logs-port>"
- name: "DD_LOGS_CONFIG_LOGS_NO_SSL"
  value: "true"

# Metrics → Sawmills Collector
- name: "DD_DD_URL"
  value: "http://<collector-service>.<namespace>.svc.cluster.local:<metrics-port>"
- name: "DD_USE_V2_API_SERIES"
  value: "true"

# Traces → Datadog directly (do NOT route through Sawmills)
- name: "DD_APM_ENABLED"
  value: "true"
- name: "DD_APM_DD_URL"
  value: "https://trace.agent.datadoghq.com"
```

### Configuration File

```yaml theme={null}
# Logs → Sawmills Collector
logs_enabled: true
logs_config:
  use_http: true
  force_use_http: true
  logs_dd_url: <collector-service>.<namespace>.svc.cluster.local:<logs-port>
  logs_no_ssl: true

# Metrics → Sawmills Collector
dd_url: http://<collector-service>.<namespace>.svc.cluster.local:<metrics-port>
use_v2_api.series: true

# Traces → Datadog directly (do NOT route through Sawmills)
apm_config:
  enabled: true
  dd_url: https://trace.agent.datadoghq.com
```

<Note>Replace `<logs-port>` and `<metrics-port>` with the ports configured in your Sawmills Collector's [Datadog Source](/docs/source-datadog). The default logs port is **10518** and the default metrics port is **8126**.</Note>

***

## Datadog Serverless Forwarder (AWS Lambda)

If you are using the [Datadog Serverless Forwarder](https://github.com/DataDog/datadog-serverless-functions/tree/master/aws/logs_monitoring) (`dd-serverless-forwarder`) to ship AWS logs to Datadog, you can route those logs through the Sawmills Collector by editing these environment variables on the Lambda function:

| Environment Variable | Description                                                                                                                                                                  |
| :------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DD_URL`             | The Lambda-reachable Sawmills Collector endpoint (e.g., an internal NLB DNS name like `internal-collector-abc123.us-east-1.elb.amazonaws.com`)                               |
| `DD_PORT`            | The Sawmills Collector port (e.g., `10518` for logs)                                                                                                                         |
| `DD_NO_SSL`          | Set to `true` if SSL is not required                                                                                                                                         |
| `DD_API_URL`         | The Datadog API endpoint used by the Forwarder for API key validation (e.g., `https://api.datadoghq.com` for US1). Keep this pointed at Datadog, not the Sawmills Collector. |

Once these variables are set, all logs forwarded by the Lambda function will flow through the Sawmills Collector.

**Important:** The Datadog Forwarder validates the Datadog API key during Lambda initialization, before it sends logs to `/api/v2/logs`. If the Lambda runs in a private VPC, make sure it has outbound HTTPS (`tcp/443`) access to the Datadog API endpoint configured in `DD_API_URL`. If that validation request is blocked, the Lambda can time out during init and no log submissions will reach the Sawmills Collector.

<Note>
  Make sure the Sawmills Collector is reachable from the AWS Lambda function's
  network (e.g., via an internal NLB, PrivateLink, VPC peering with resolvable
  private DNS, or a public endpoint). Kubernetes service DNS names such as
  `<collector-service>.<namespace>.svc.cluster.local` are usually only
  resolvable inside the cluster. Refer to [Configure the Sawmills Collector for
  External Access](/docs/send-data-to-collector) for details.
</Note>

***

## Restart the Datadog Agent

After saving the configuration changes, restart the Datadog agent to apply them:

```bash theme={null}
sudo systemctl restart datadog-agent
```

## Verify Data Flow

To confirm the data flow from the Datadog agent to the Sawmills Collector:

1. **View the Datadog agent logs** to confirm there are no errors in connecting to the Sawmills Collector:

   ```bash theme={null}
   sudo tail -f /var/log/datadog/agent.log
   ```

2. **Check the Sawmills Collector logs** in the destination cluster to ensure it is receiving data from the Datadog agent.

3. **Check your backend or monitoring system** (e.g., Prometheus, Grafana) to ensure the Sawmills Collector is forwarding data as expected.

## Configuration File Location

If you installed the Datadog agent using a different method, the configuration file is usually located at `/etc/datadog-agent/datadog.yaml` on your Datadog agent host.

## Troubleshooting

* **Connection Issues**: If the Datadog agent can't reach the Sawmills Collector, verify network connectivity and firewall settings.
* **Configuration Errors**: Double-check the Datadog agent's configuration for correct endpoints, ports, and protocols.
* **External Accessibility**: Ensure that your Ingress or NodePort service for the Sawmills Collector is accessible from the source cluster.
* **Missing Metrics**: Ensure `DD_USE_V2_API_SERIES` is set to `true`. The Sawmills Collector requires the v2 series API format.
* **Missing Traces**: Traces are not supported through the Sawmills Collector. Verify that `DD_APM_DD_URL` is not pointing to the Sawmills Collector.
