Datadog 출력 플러그인
로그를 Datadog으로 보내고 싶을 때 쓰는 출력 플러그인입니다. 함께 살펴보겠습니다.
출처: 문서
본문
Datadog으로 로그 보내기
Datadog 출력 플러그인은 로그를 Datadog으로 수집할 수 있게 해 줍니다.
시작하기 전에 Datadog 계정, Datadog API 키, 그리고 Datadog Logs Management 활성화가 필요합니다.
Configuration parameters
| Key | Description | Default |
|---|---|---|
apikey |
Your Datadog API key. | none |
compress |
Compresses the payload in GZIP format. Datadog supports and recommends setting this to gzip. |
false |
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 for recognized attributes. |
none |
dd_message_key |
By default, the plugin searches for the key log and remaps the value to the key message. If the property is set, the plugin searches for the property name key. |
log |
dd_service |
Recommended. The human readable name for your service generating the logs. For example, the name of your application or database. If not set, Datadog looks for the service using service remapper. | none |
dd_source |
Recommended. A human-readable name for the underlying technology of your service like postgres or nginx. If unset, Datadog looks for the source in the ddsource attribute. |
none |
dd_tags |
The tags you want to assign to your logs in Datadog. If unset, Datadog looks for the tags in the ddtags attribute. |
none |
header |
Add additional arbitrary HTTP header key/value pair. Multiple headers can be set. | none |
host |
The Datadog server where you are sending your logs. | http-intake.logs.datadoghq.com |
include_tag_key |
If enabled, a tag is appended to the output. The key name is used with the tag_key property. |
false |
json_date_key |
Date key name for output. | timestamp |
provider |
To activate remapping, specify the configuration flag provider with the value ecs. |
none |
proxy |
Specifies an HTTP proxy. The expected format of this value is http://host:port. HTTPS isn't supported. |
none |
tag_key |
The key name of tag. If include_tag_key is false, this property is ignored. |
tagkey |
tls |
End-to-end security communications protocol. Datadog recommends setting this to on. |
off |
workers |
The number of workers to perform flush operations for this output. | 0 |
구성 파일
이 구성 파일로 시작해 보세요:
{% tabs %} {% tab title="fluent-bit.yaml" %}
pipeline:
outputs:
- name: datadog
match: '*'
host: http-intake.logs.datadoghq.com
tls: on
compress: gzip
apikey: <my-da...key>
dd_service: <my-app-service>
dd_source: <my-app-source>
dd_tags: team:logs,foo:bar
dd_hostname: myhost
{% endtab %}
{% tab title="fluent-bit.conf" %}
[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
{% endtab %} {% endtabs %}
문제 해결
403 Forbidden 오류 응답이 나오면 유효한 Datadog API 키가 있는지, 그리고 Datadog Logs Management를 활성화했는지 다시 확인하세요.