# Datadog

The Datadog output plugin allows to ingest your logs into [Datadog](https://app.datadoghq.com/signup).

Before you begin, you need a [Datadog account](https://app.datadoghq.com/signup), a [Datadog API key](https://docs.datadoghq.com/account_management/api-app-keys/), and you need to [activate Datadog Logs Management](https://app.datadoghq.com/logs/activation).

## Configuration Parameters

| Key               | Description                                                                                                                                                                                                                                                                                                               | Default                          |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| Host              | *Required* - The Datadog server where you are sending your logs.                                                                                                                                                                                                                                                          | `http-intake.logs.datadoghq.com` |
| TLS               | *Required* - End-to-end security communications security protocol. Datadog recommends setting this to `on`.                                                                                                                                                                                                               | `off`                            |
| compress          | *Recommended* - compresses the payload in GZIP format, Datadog supports and recommends setting this to `gzip`.                                                                                                                                                                                                            |                                  |
| apikey            | *Required* - Your [Datadog API key](https://app.datadoghq.com/account/settings#api).                                                                                                                                                                                                                                      |                                  |
| Proxy             | *Optional* - Specify an HTTP Proxy. The expected format of this value is [http://host:port](http://host/:port). Note that *https* is **not** supported yet.                                                                                                                                                               |                                  |
| provider          | To activate the remapping, specify configuration flag provider with value `ecs`.                                                                                                                                                                                                                                          |                                  |
| json\_date\_key   | Date key name for output.                                                                                                                                                                                                                                                                                                 | `timestamp`                      |
| include\_tag\_key | If enabled, a tag is appended to output. The key name is used `tag_key` property.                                                                                                                                                                                                                                         | `false`                          |
| tag\_key          | The key name of tag. If `include_tag_key` is false, This property is ignored.                                                                                                                                                                                                                                             | `tagkey`                         |
| dd\_service       | *Recommended* - The human readable name for your service generating the logs (e.g. the name of your application or database). If unset, Datadog will look for the service using [Service Remapper](https://docs.datadoghq.com/logs/log_configuration/pipelines/?tab=service#service-attribute)."                          |                                  |
| dd\_source        | *Recommended* - A human readable name for the underlying technology of your service (e.g. `postgres` or `nginx`). If unset, Datadog will look for the source in the [`ddsource` attribute](https://docs.datadoghq.com/logs/log_configuration/pipelines/?tab=source#source-attribute).                                     |                                  |
| dd\_tags          | *Optional* - The [tags](https://docs.datadoghq.com/tagging/) you want to assign to your logs in Datadog. If unset, Datadog will look for the tags in the [`ddtags` attribute](https://docs.datadoghq.com/api/latest/logs/#send-logs).                                                                                     |                                  |
| dd\_message\_key  | By default, the plugin searches for the key 'log' and remap the value to the key 'message'. If the property is set, the plugin will search the property name key.                                                                                                                                                         |                                  |
| dd\_hostname      | The host the emitted logs should be associated with. If unset, Datadog expects the host to be set with `host`, `hostname`, or `syslog.hostname` attributes. See [Datadog Logs preprocessor documentation](https://docs.datadoghq.com/logs/log_configuration/pipelines/?tab=host#preprocessing) for recognized attributes. | *none*                           |
| workers           | The number of [workers](https://docs.fluentbit.io/manual/3.2/administration/multithreading#outputs) to perform flush operations for this output.                                                                                                                                                                          | `0`                              |
| header            | Add additional arbitrary HTTP header key/value pair. Multiple headers can be set.                                                                                                                                                                                                                                         | *none*                           |

### Configuration File

Get started quickly with this configuration file:

```
[OUTPUT]
    Name        datadog
    Match       *
    Host        http-intake.logs.datadoghq.com
    TLS         on
    compress    gzip
    apikey      <my-datadog-api-key>
    dd_service  <my-app-service>
    dd_source   <my-app-source>
    dd_tags     team:logs,foo:bar
    dd_hostname myhost
```

## Troubleshooting

### 403 Forbidden

If you get a `403 Forbidden` error response, double check that you have a valid [Datadog API key](https://docs.datadoghq.com/account_management/api-app-keys/) and that you have [activated Datadog Logs Management](https://app.datadoghq.com/logs/activation).
