fluent-plugin-datadog 0.14.4 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/fluent-plugin-datadog.gemspec +2 -2
- data/lib/fluent/plugin/out_datadog.rb +18 -7
- data/lib/fluent/plugin/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ada0477abc2674f1139d27ee6aa58cca24dc4c0f23414a651432b2d1689729e
|
|
4
|
+
data.tar.gz: c2e02ecf94b0453bad5bc2b8683396b8a0a02faba89b17e46d925a25e80ccda1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6da0566bf7b59b6316ef98fdefa74b1626cd0a21be8a4080b014a617db9f769a3c0cc4cb502c3526d4aefa00dea7cef0f744ebc77fb2c4f9a23dc8689ee71436
|
|
7
|
+
data.tar.gz: d2d6f2b098a9290f75d4a217b0fe5803306161a04bfdfb59d918f4d7a0ec335a46def23c74f0e84e8eb27797f5dcc09fc393ae23e0df96a7a526c8e0fb31738e
|
data/README.md
CHANGED
|
@@ -19,6 +19,7 @@ If you installed the td-agent instead
|
|
|
19
19
|
/usr/sbin/td-agent-gem install fluent-plugin-datadog
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
|
+
|
|
22
23
|
### Configure the output plugin
|
|
23
24
|
|
|
24
25
|
To match events and send them to Datadog, simply add the following code to your configuration file.
|
|
@@ -74,10 +75,9 @@ Produces the following event:
|
|
|
74
75
|
}
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
###
|
|
78
|
-
Let's go deeper on the plugin configuration.
|
|
78
|
+
### Advanced configuration
|
|
79
79
|
|
|
80
|
-
As fluent-plugin-datadog is
|
|
80
|
+
As `fluent-plugin-datadog` is a buffered output plugin, you can set all of the buffered output-specific properties as described in the [fluentd documentation](https://docs.fluentd.org/v/0.12/output#buffered-output-parameters).
|
|
81
81
|
|
|
82
82
|
| Property | Description | Default value |
|
|
83
83
|
|-------------|--------------------------------------------------------------------------|----------------|
|
|
@@ -102,6 +102,7 @@ As fluent-plugin-datadog is an output_buffer, you can set all output_buffer prop
|
|
|
102
102
|
| **port** | Proxy port when logs are not directly forwarded to Datadog and ssl is not used | 80 |
|
|
103
103
|
| **host** | Proxy endpoint when logs are not directly forwarded to Datadog | http-intake.logs.datadoghq.com |
|
|
104
104
|
| **http_proxy** | HTTP proxy, only takes effect if HTTP forwarding is enabled (`use_http`). Defaults to `HTTP_PROXY`/`http_proxy` env vars. | nil |
|
|
105
|
+
| **delete_extracted_tag_attributes** | When true, removes `kubernetes` and `docker` attributes from log records after extracting them as tags. Useful to avoid duplicate data in Datadog logs UI. | false |
|
|
105
106
|
|
|
106
107
|
### Docker and Kubernetes tags
|
|
107
108
|
|
|
@@ -115,6 +116,8 @@ If your logs contain any of the following attributes, it will automatically be a
|
|
|
115
116
|
* kubernetes.pod_name
|
|
116
117
|
* docker.container_id
|
|
117
118
|
|
|
119
|
+
**Note:** By default, these values will appear twice in the Datadog logs UI, once as tags (e.g., `container_name:myapp`) and once as attributes (e.g., `@kubernetes.container_name`). If you prefer to avoid this duplication, set `delete_extracted_tag_attributes` to `true` in your configuration. This will remove the `kubernetes` and `docker` attributes from the log record after the tags have been extracted.
|
|
120
|
+
|
|
118
121
|
If the Datadog Agent collect them automatically, FluentD requires a plugin for this. We recommend using [fluent-plugin-kubernetes_metadata_filter](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter) to collect Docker and Kubernetes metadata.
|
|
119
122
|
|
|
120
123
|
Configuration example:
|
|
@@ -156,3 +159,11 @@ To build a new version of this plugin and push it to RubyGems:
|
|
|
156
159
|
|
|
157
160
|
`curl -u <USERNAME> https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials`, it will ask for your password.
|
|
158
161
|
|
|
162
|
+
## Development Environment
|
|
163
|
+
|
|
164
|
+
This repository includes the files to run it in a dev container in VS Code. To use it:
|
|
165
|
+
|
|
166
|
+
1. Install VS Code and Docker.
|
|
167
|
+
2. Open the project in VS Code with the Dev Containers extension.
|
|
168
|
+
|
|
169
|
+
VS Code will build and start the container automatically.
|
|
@@ -28,9 +28,9 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 2.1"
|
|
30
30
|
spec.add_development_dependency "test-unit", '~> 3.1'
|
|
31
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
|
32
|
-
spec.add_development_dependency "yajl-ruby", "~> 1.2"
|
|
33
31
|
spec.add_development_dependency 'webmock', "~> 3.6.0"
|
|
32
|
+
spec.add_development_dependency "ruby-debug-ide"
|
|
33
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
|
34
34
|
|
|
35
35
|
spec.metadata = {
|
|
36
36
|
'bug_tracker_uri' => 'https://github.com/DataDog/fluent-plugin-datadog/issues',
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
require "socket"
|
|
7
7
|
require "openssl"
|
|
8
|
-
require "
|
|
8
|
+
require "json"
|
|
9
9
|
require "zlib"
|
|
10
10
|
require "fluent/plugin/output"
|
|
11
11
|
|
|
@@ -43,6 +43,7 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
43
43
|
config_param :dd_source, :string, :default => nil
|
|
44
44
|
config_param :dd_tags, :string, :default => nil
|
|
45
45
|
config_param :dd_hostname, :string, :default => nil
|
|
46
|
+
config_param :delete_extracted_tag_attributes, :bool, :default => false
|
|
46
47
|
|
|
47
48
|
# Connection settings
|
|
48
49
|
config_param :host, :string, :default => DD_DEFAULT_HTTP_ENDPOINT
|
|
@@ -52,6 +53,7 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
52
53
|
config_param :max_retries, :integer, :default => -1
|
|
53
54
|
config_param :max_backoff, :integer, :default => 30
|
|
54
55
|
config_param :use_http, :bool, :default => true
|
|
56
|
+
config_param :custom_headers, :hash, :default => {}
|
|
55
57
|
config_param :use_compression, :bool, :default => true
|
|
56
58
|
config_param :compression_level, :integer, :default => 6
|
|
57
59
|
config_param :no_ssl_validation, :bool, :default => false
|
|
@@ -98,7 +100,7 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
98
100
|
|
|
99
101
|
def start
|
|
100
102
|
super
|
|
101
|
-
@client = new_client(log, @api_key, @use_http, @use_ssl, @no_ssl_validation, @host, @ssl_port, @port, @http_proxy, @use_compression, @force_v1_routes)
|
|
103
|
+
@client = new_client(log, @api_key, @use_http, @use_ssl, @no_ssl_validation, @host, @ssl_port, @port, @http_proxy, @custom_headers, @use_compression, @force_v1_routes)
|
|
102
104
|
end
|
|
103
105
|
|
|
104
106
|
def shutdown
|
|
@@ -117,10 +119,10 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
117
119
|
# is compatible with Time.at below.
|
|
118
120
|
record = enrich_record(tag, time.to_f, record)
|
|
119
121
|
if @use_http
|
|
120
|
-
record =
|
|
122
|
+
record = JSON.generate(record)
|
|
121
123
|
else
|
|
122
124
|
if @use_json
|
|
123
|
-
record = "#{api_key} #{
|
|
125
|
+
record = "#{api_key} #{JSON.generate(record)}"
|
|
124
126
|
else
|
|
125
127
|
record = "#{api_key} #{record}"
|
|
126
128
|
end
|
|
@@ -253,6 +255,12 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
253
255
|
record["ddtags"] = record["ddtags"] + "," + container_tags
|
|
254
256
|
end
|
|
255
257
|
end
|
|
258
|
+
|
|
259
|
+
if @delete_extracted_tag_attributes
|
|
260
|
+
record.delete('kubernetes')
|
|
261
|
+
record.delete('docker')
|
|
262
|
+
end
|
|
263
|
+
|
|
256
264
|
record
|
|
257
265
|
end
|
|
258
266
|
|
|
@@ -270,9 +278,9 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
270
278
|
end
|
|
271
279
|
|
|
272
280
|
# Build a new transport client
|
|
273
|
-
def new_client(logger, api_key, use_http, use_ssl, no_ssl_validation, host, ssl_port, port, http_proxy, use_compression, force_v1_routes)
|
|
281
|
+
def new_client(logger, api_key, use_http, use_ssl, no_ssl_validation, host, ssl_port, port, http_proxy, custom_headers, use_compression, force_v1_routes)
|
|
274
282
|
if use_http
|
|
275
|
-
DatadogHTTPClient.new logger, use_ssl, no_ssl_validation, host, ssl_port, port, http_proxy, use_compression, api_key, force_v1_routes
|
|
283
|
+
DatadogHTTPClient.new logger, use_ssl, no_ssl_validation, host, ssl_port, port, http_proxy, custom_headers, use_compression, api_key, force_v1_routes
|
|
276
284
|
else
|
|
277
285
|
DatadogTCPClient.new logger, use_ssl, no_ssl_validation, host, ssl_port, port
|
|
278
286
|
end
|
|
@@ -310,7 +318,7 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
310
318
|
require 'net/http'
|
|
311
319
|
require 'net/http/persistent'
|
|
312
320
|
|
|
313
|
-
def initialize(logger, use_ssl, no_ssl_validation, host, ssl_port, port, http_proxy, use_compression, api_key, force_v1_routes = false)
|
|
321
|
+
def initialize(logger, use_ssl, no_ssl_validation, host, ssl_port, port, http_proxy, custom_headers, use_compression, api_key, force_v1_routes = false)
|
|
314
322
|
@logger = logger
|
|
315
323
|
protocol = use_ssl ? "https" : "http"
|
|
316
324
|
port = use_ssl ? ssl_port : port
|
|
@@ -328,6 +336,9 @@ class Fluent::DatadogOutput < Fluent::Plugin::Output
|
|
|
328
336
|
logger.info("Starting HTTP connection to #{protocol}://#{host}:#{port.to_s} with compression " + (use_compression ? "enabled" : "disabled") + (force_v1_routes ? " using v1 routes" : " using v2 routes"))
|
|
329
337
|
@client = Net::HTTP::Persistent.new name: "fluent-plugin-datadog-logcollector", proxy: proxy_uri
|
|
330
338
|
@client.verify_mode = OpenSSL::SSL::VERIFY_NONE if no_ssl_validation
|
|
339
|
+
custom_headers.each do |key, value|
|
|
340
|
+
@client.override_headers[key] = value
|
|
341
|
+
end
|
|
331
342
|
unless force_v1_routes
|
|
332
343
|
@client.override_headers["DD-API-KEY"] = api_key
|
|
333
344
|
@client.override_headers["DD-EVP-ORIGIN"] = "fluent"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-datadog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog Solutions Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-12-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fluentd
|
|
@@ -73,47 +73,47 @@ dependencies:
|
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
74
|
version: '3.1'
|
|
75
75
|
- !ruby/object:Gem::Dependency
|
|
76
|
-
name:
|
|
76
|
+
name: webmock
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
81
|
+
version: 3.6.0
|
|
82
82
|
type: :development
|
|
83
83
|
prerelease: false
|
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
88
|
+
version: 3.6.0
|
|
89
89
|
- !ruby/object:Gem::Dependency
|
|
90
|
-
name:
|
|
90
|
+
name: ruby-debug-ide
|
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
|
-
- - "
|
|
93
|
+
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
95
|
+
version: '0'
|
|
96
96
|
type: :development
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
|
-
- - "
|
|
100
|
+
- - ">="
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
102
|
+
version: '0'
|
|
103
103
|
- !ruby/object:Gem::Dependency
|
|
104
|
-
name:
|
|
104
|
+
name: rake
|
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version:
|
|
109
|
+
version: '12.0'
|
|
110
110
|
type: :development
|
|
111
111
|
prerelease: false
|
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version:
|
|
116
|
+
version: '12.0'
|
|
117
117
|
description:
|
|
118
118
|
email:
|
|
119
119
|
- support@datadoghq.com
|
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
152
152
|
- !ruby/object:Gem::Version
|
|
153
153
|
version: '0'
|
|
154
154
|
requirements: []
|
|
155
|
-
rubygems_version: 3.
|
|
155
|
+
rubygems_version: 3.4.10
|
|
156
156
|
signing_key:
|
|
157
157
|
specification_version: 4
|
|
158
158
|
summary: Datadog output plugin for Fluent event collector
|