fluent-plugin-datadog-log 0.1.0.rc18 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -14
- data/README.rdoc +0 -8
- data/fluent-plugin-datadog-log.gemspec +4 -6
- data/lib/fluent/plugin/out_datadog_log.rb +100 -84
- data/pkg/fluent-plugin-datadog-0.1.0.gem +0 -0
- data/pkg/fluent-plugin-datadog-log-0.1.0.gem +0 -0
- data/test/plugin/test_out_datadog_log.rb +2 -85
- metadata +23 -48
- data/fluent-plugin-datadog-log.gemspec~ +0 -33
- data/lib/datadog/log.rb~ +0 -125
- data/lib/fluent/plugin/datadog_log.rb +0 -166
- data/lib/fluent/plugin/datadog_log.rb~ +0 -131
- data/lib/fluent/plugin/out_datadog_log.rb~ +0 -584
- data/pkg/fluent-plugin-datadog-log-0.1.0.rc13.gem +0 -0
- data/pkg/fluent-plugin-datadog-log-0.1.0.rc14.gem +0 -0
- data/pkg/fluent-plugin-datadog-log-0.1.0.rc15.gem +0 -0
- data/pkg/fluent-plugin-datadog-log-0.1.0.rc16.gem +0 -0
- data/pkg/fluent-plugin-datadog-log-0.1.0.rc17.gem +0 -0
- data/pkg/fluent-plugin-datadog-log-0.1.0.rc18.gem +0 -0
- data/test/plugin/test_out_datadog_log.rb~ +0 -278
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-datadog-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke KUOKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0.14'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,41 +45,13 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.0.1
|
48
|
-
type: :
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.0.1
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: prometheus-client
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.7.1
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.7.1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: semantic_logger
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 4.2.0
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 4.2.0
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
56
|
name: mocha
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +122,20 @@ dependencies:
|
|
150
122
|
- - "~>"
|
151
123
|
- !ruby/object:Gem::Version
|
152
124
|
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: prometheus-client
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.7.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.7.1
|
153
139
|
description: |2
|
154
140
|
Fluentd output plugin for the Datadog Log Intake API, which will make
|
155
141
|
logs viewable in the Datadog's log viewer.
|
@@ -165,25 +151,15 @@ files:
|
|
165
151
|
- README.rdoc
|
166
152
|
- Rakefile
|
167
153
|
- fluent-plugin-datadog-log.gemspec
|
168
|
-
- fluent-plugin-datadog-log.gemspec~
|
169
154
|
- fluent-plugin-datadog.gemspec~
|
170
|
-
- lib/datadog/log.rb~
|
171
|
-
- lib/fluent/plugin/datadog_log.rb
|
172
|
-
- lib/fluent/plugin/datadog_log.rb~
|
173
155
|
- lib/fluent/plugin/monitoring.rb
|
174
156
|
- lib/fluent/plugin/out_datadog_log.rb
|
175
|
-
-
|
176
|
-
- pkg/fluent-plugin-datadog-log-0.1.0.
|
177
|
-
- pkg/fluent-plugin-datadog-log-0.1.0.rc14.gem
|
178
|
-
- pkg/fluent-plugin-datadog-log-0.1.0.rc15.gem
|
179
|
-
- pkg/fluent-plugin-datadog-log-0.1.0.rc16.gem
|
180
|
-
- pkg/fluent-plugin-datadog-log-0.1.0.rc17.gem
|
181
|
-
- pkg/fluent-plugin-datadog-log-0.1.0.rc18.gem
|
157
|
+
- pkg/fluent-plugin-datadog-0.1.0.gem
|
158
|
+
- pkg/fluent-plugin-datadog-log-0.1.0.gem
|
182
159
|
- test/helper.rb
|
183
160
|
- test/plugin/base_test.rb
|
184
161
|
- test/plugin/constants.rb
|
185
162
|
- test/plugin/test_out_datadog_log.rb
|
186
|
-
- test/plugin/test_out_datadog_log.rb~
|
187
163
|
homepage: https://github.com/mumoshu/fluent-plugin-datadog-log
|
188
164
|
licenses:
|
189
165
|
- Apache-2.0
|
@@ -199,9 +175,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
175
|
version: '2.0'
|
200
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
177
|
requirements:
|
202
|
-
- - "
|
178
|
+
- - ">="
|
203
179
|
- !ruby/object:Gem::Version
|
204
|
-
version:
|
180
|
+
version: '0'
|
205
181
|
requirements: []
|
206
182
|
rubyforge_project:
|
207
183
|
rubygems_version: 2.6.13
|
@@ -213,4 +189,3 @@ test_files:
|
|
213
189
|
- test/plugin/base_test.rb
|
214
190
|
- test/plugin/constants.rb
|
215
191
|
- test/plugin/test_out_datadog_log.rb
|
216
|
-
- test/plugin/test_out_datadog_log.rb~
|
@@ -1,33 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |gem|
|
2
|
-
gem.name = 'fluent-plugin-datadog-log'
|
3
|
-
gem.description = <<-eos
|
4
|
-
Fluentd output plugin for the Datadog Log Intake API, which will make
|
5
|
-
logs viewable in the Datadog's log viewer.
|
6
|
-
eos
|
7
|
-
gem.summary = 'fluentd output plugin for the Datadog Log Intake API'
|
8
|
-
gem.homepage = \
|
9
|
-
'https://github.com/mumoshu/fluent-plugin-datadog-log'
|
10
|
-
gem.license = 'Apache-2.0'
|
11
|
-
gem.version = '0.1.0.rc12'
|
12
|
-
gem.authors = ['Yusuke KUOKA']
|
13
|
-
gem.email = ['ykuoka@gmail.com']
|
14
|
-
gem.required_ruby_version = Gem::Requirement.new('>= 2.0')
|
15
|
-
|
16
|
-
gem.files = Dir['**/*'].keep_if { |file| File.file?(file) }
|
17
|
-
gem.test_files = gem.files.grep(/^(test)/)
|
18
|
-
gem.require_paths = ['lib']
|
19
|
-
|
20
|
-
gem.add_runtime_dependency 'fluentd', '~> 1.0.0'
|
21
|
-
# gem.add_runtime_dependency 'datadog-log-api-client', '~> 0.1'
|
22
|
-
gem.add_runtime_dependency 'json', '~> 1.8'
|
23
|
-
|
24
|
-
gem.add_dependency 'net_tcp_client', '~> 2.0.1'
|
25
|
-
gem.add_dependency 'prometheus-client', '~> 0.7.1'
|
26
|
-
gem.add_dependency 'semantic_logger', '~> 4.2.0'
|
27
|
-
|
28
|
-
gem.add_development_dependency 'mocha', '~> 1.1'
|
29
|
-
gem.add_development_dependency 'rake', '~> 10.3'
|
30
|
-
gem.add_development_dependency 'rubocop', '~> 0.35.0'
|
31
|
-
gem.add_development_dependency 'webmock', '~> 2.3.1'
|
32
|
-
gem.add_development_dependency 'test-unit', '~> 3.0'
|
33
|
-
end
|
data/lib/datadog/log.rb~
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
require 'net/tcp_client'
|
3
|
-
require 'socket'
|
4
|
-
require 'time'
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module Log
|
8
|
-
TRUNCATED_MSG = '...TRUNCATED...'
|
9
|
-
|
10
|
-
TRUNCATED_LEN = TRUNCATED_MSG.size
|
11
|
-
|
12
|
-
# MaxMessageLen is the maximum length for any message we send to the intake
|
13
|
-
# see https://github.com/DataDog/datadog-log-agent/blob/2394da8c79a6cadbcd1e98d6c89c437becec2732/pkg/config/constants.go#L9-L10
|
14
|
-
DD_MAX_MESSAGE_LEN = 1 * 1000 * 1000
|
15
|
-
|
16
|
-
MAX_MESSAGE_LEN = DD_MAX_MESSAGE_LEN - TRUNCATED_LEN
|
17
|
-
|
18
|
-
def truncate_message(msg)
|
19
|
-
if msg.size > DD_MAX_MESSAGE_LEN
|
20
|
-
msg.slice(0, MAX_MESSAGE_LEN) + TRUNCATED_MSG
|
21
|
-
else
|
22
|
-
msg
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Given a list of tags, build_tags_payload generates the bytes array
|
27
|
-
# that will be inserted into messages
|
28
|
-
# @see https://github.com/DataDog/datadog-log-agent/blob/2394da8c79a6cadbcd1e98d6c89c437becec2732/pkg/config/integration_config.go#L180
|
29
|
-
def build_tags_payload(config_tags:, source:, source_category:)
|
30
|
-
payload = ''
|
31
|
-
|
32
|
-
payload = "[dd ddsource=\"#{source}\"]" if !source.nil? && source != ''
|
33
|
-
|
34
|
-
if !source_category.nil? && source_category != ''
|
35
|
-
payload = "#{payload}[dd ddsourcecategory=\"#{source_category}\"]"
|
36
|
-
end
|
37
|
-
|
38
|
-
if !config_tags.nil? && config_tags != ''
|
39
|
-
config_tags = config_tags.join(',') if config_tags.is_a? ::Array
|
40
|
-
payload = "#{payload}[dd ddtags=\"#{config_tags}\"]"
|
41
|
-
end
|
42
|
-
|
43
|
-
payload
|
44
|
-
end
|
45
|
-
|
46
|
-
# https://github.com/DataDog/datadog-log-agent/blob/db13b53dfdd036d43acfb15089a43eb31548f09f/pkg/processor/processor.go#L65
|
47
|
-
def build_extra_content(timestamp:, hostname:, service:, tags_payload:)
|
48
|
-
"<46>0 #{timestamp} #{hostname} #{service} - - #{tags_payload}"
|
49
|
-
end
|
50
|
-
|
51
|
-
def build_api_key_str(api_key:, logset:)
|
52
|
-
if !logset.nil? && logset != ''
|
53
|
-
"#{api_key}/#{logset}"
|
54
|
-
else
|
55
|
-
api_key
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# build_payload returns a processed payload from a raw message
|
60
|
-
# @param [String] api_key_str
|
61
|
-
# @param [String] extra_content
|
62
|
-
# @param [String] msg
|
63
|
-
def create_payload(api_key_str:, msg:, extra_content:)
|
64
|
-
"#{api_key_str} #{extra_content} #{msg}\n"
|
65
|
-
end
|
66
|
-
|
67
|
-
class Client
|
68
|
-
include ::Datadog::Log
|
69
|
-
|
70
|
-
def initialize(log_dd_url: 'intake.logs.datadoghq.com', log_dd_port: 10516, api_key:, hostname:, skip_ssl_validation: false)
|
71
|
-
@log_dd_url = log_dd_url
|
72
|
-
@log_dd_port = log_dd_port
|
73
|
-
@api_key = api_key
|
74
|
-
@hostname = hostname
|
75
|
-
@skip_ssl_validation = skip_ssl_validation
|
76
|
-
|
77
|
-
init_api_client
|
78
|
-
end
|
79
|
-
|
80
|
-
def send_payload(logset: 'main', msg:, datetime: nil, service:, source:, source_category:, tags:)
|
81
|
-
datetime = DateTime.now if datetime.nil?
|
82
|
-
|
83
|
-
# new_offset(0) is required. otherwise datadog will silently throws away the log..
|
84
|
-
timestamp_str = datetime.new_offset(0).rfc3339(6)
|
85
|
-
payload = create_payload(
|
86
|
-
api_key_str: build_api_key_str(api_key: @api_key, logset: logset),
|
87
|
-
msg: truncate_message(msg),
|
88
|
-
extra_content: build_extra_content(
|
89
|
-
timestamp: timestamp_str,
|
90
|
-
hostname: @hostname,
|
91
|
-
service: service,
|
92
|
-
tags_payload: build_tags_payload(
|
93
|
-
config_tags: tags,
|
94
|
-
source: source,
|
95
|
-
source_category: source_category
|
96
|
-
)
|
97
|
-
)
|
98
|
-
)
|
99
|
-
@conn.retry_on_connection_failure do
|
100
|
-
@conn.write(payload)
|
101
|
-
end
|
102
|
-
payload
|
103
|
-
end
|
104
|
-
|
105
|
-
def shutdown
|
106
|
-
@conn.close unless @conn.nil?
|
107
|
-
end
|
108
|
-
|
109
|
-
class << self
|
110
|
-
def from_env
|
111
|
-
new(api_key: ENV['DD_LOG_API_KEY'], hostname: Socket.gethostname)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
private
|
116
|
-
|
117
|
-
def init_api_client
|
118
|
-
ssl = true
|
119
|
-
ssl = { verify_mode: OpenSSL::SSL::VERIFY_NONE } if @skip_ssl_validation
|
120
|
-
server = "#{@log_dd_url}:#{@log_dd_port}"
|
121
|
-
@conn = Net::TCPClient.new(server: server, ssl: ssl)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,166 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
|
3
|
-
require 'semantic_logger'
|
4
|
-
|
5
|
-
SemanticLogger.default_level = :info
|
6
|
-
SemanticLogger.add_appender(io: STDOUT, formatter: :json)
|
7
|
-
|
8
|
-
require 'net/tcp_client'
|
9
|
-
require 'socket'
|
10
|
-
require 'time'
|
11
|
-
|
12
|
-
# Never give up on a write timeout/Fix for:
|
13
|
-
# Not retrying a log message later
|
14
|
-
# error=\"Timed out after 60.0 seconds trying to write to
|
15
|
-
# intake.logs.datadoghq.com[52.206.154.220]:10516\"
|
16
|
-
# error_class=Net::TCPClient::WriteTimeout
|
17
|
-
Net::TCPClient.reconnect_on_errors << Net::TCPClient::WriteTimeout
|
18
|
-
|
19
|
-
# Never give up on a corrupted SSL connection/Fix for:
|
20
|
-
# Not retrying a log message later
|
21
|
-
# error="SSL_write: bad write retry"
|
22
|
-
# error_class=OpenSSL::SSL::SSLError
|
23
|
-
Net::TCPClient.reconnect_on_errors << OpenSSL::SSL::SSLError
|
24
|
-
|
25
|
-
# Datadog provides various helpers to programatically access Datadog services
|
26
|
-
module Datadog
|
27
|
-
# Log provides various helpers and classes to support programatically
|
28
|
-
# accessing Datadog Log Management
|
29
|
-
module Log
|
30
|
-
TRUNCATED_MSG = '...TRUNCATED...'
|
31
|
-
|
32
|
-
TRUNCATED_LEN = TRUNCATED_MSG.size
|
33
|
-
|
34
|
-
# MaxMessageLen is the maximum length for any message we send to the intake
|
35
|
-
# see https://github.com/DataDog/datadog-log-agent/blob/2394da8c79a6cadbcd1e98d6c89c437becec2732/pkg/config/constants.go#L9-L10
|
36
|
-
DD_MAX_MESSAGE_LEN = 1 * 1000 * 1000
|
37
|
-
|
38
|
-
MAX_MESSAGE_LEN = DD_MAX_MESSAGE_LEN - TRUNCATED_LEN
|
39
|
-
|
40
|
-
def truncate_message(msg)
|
41
|
-
if msg.size > DD_MAX_MESSAGE_LEN
|
42
|
-
msg.slice(0, MAX_MESSAGE_LEN) + TRUNCATED_MSG
|
43
|
-
else
|
44
|
-
msg
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Given a list of tags, build_tags_payload generates the bytes array
|
49
|
-
# that will be inserted into messages
|
50
|
-
# @see https://github.com/DataDog/datadog-log-agent/blob/2394da8c79a6cadbcd1e98d6c89c437becec2732/pkg/config/integration_config.go#L180
|
51
|
-
def build_tags_payload(config_tags:, source:, source_category:)
|
52
|
-
payload = ''
|
53
|
-
|
54
|
-
payload = "[dd ddsource=\"#{source}\"]" if !source.nil? && source != ''
|
55
|
-
|
56
|
-
if !source_category.nil? && source_category != ''
|
57
|
-
payload = "#{payload}[dd ddsourcecategory=\"#{source_category}\"]"
|
58
|
-
end
|
59
|
-
|
60
|
-
if !config_tags.nil? && config_tags != ''
|
61
|
-
config_tags = config_tags.join(',') if config_tags.is_a? ::Array
|
62
|
-
payload = "#{payload}[dd ddtags=\"#{config_tags}\"]"
|
63
|
-
end
|
64
|
-
|
65
|
-
payload
|
66
|
-
end
|
67
|
-
|
68
|
-
# https://github.com/DataDog/datadog-log-agent/blob/db13b53dfdd036d43acfb15089a43eb31548f09f/pkg/processor/processor.go#L65
|
69
|
-
def build_extra_content(timestamp:, hostname:, service:, tags_payload:)
|
70
|
-
"<46>0 #{timestamp} #{hostname} #{service} - - #{tags_payload}"
|
71
|
-
end
|
72
|
-
|
73
|
-
def build_api_key_str(api_key:, logset:)
|
74
|
-
if !logset.nil? && logset != ''
|
75
|
-
"#{api_key}/#{logset}"
|
76
|
-
else
|
77
|
-
api_key
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# build_payload returns a processed payload from a raw message
|
82
|
-
# @param [String] api_key_str
|
83
|
-
# @param [String] extra_content
|
84
|
-
# @param [String] msg
|
85
|
-
def create_payload(api_key_str:, msg:, extra_content:)
|
86
|
-
"#{api_key_str} #{extra_content} #{msg}\n"
|
87
|
-
end
|
88
|
-
|
89
|
-
# Client supports building/sending payloads to Datadog Log Management
|
90
|
-
class Client
|
91
|
-
include ::Datadog::Log
|
92
|
-
|
93
|
-
def initialize(
|
94
|
-
log_dd_url: 'intake.logs.datadoghq.com',
|
95
|
-
log_dd_port: 10516,
|
96
|
-
api_key:,
|
97
|
-
hostname:,
|
98
|
-
skip_ssl_validation: false
|
99
|
-
)
|
100
|
-
@log_dd_url = log_dd_url
|
101
|
-
@log_dd_port = log_dd_port
|
102
|
-
@api_key = api_key
|
103
|
-
@hostname = hostname
|
104
|
-
@skip_ssl_validation = skip_ssl_validation
|
105
|
-
|
106
|
-
init_api_client
|
107
|
-
end
|
108
|
-
|
109
|
-
# rubocop:disable Metrics/ParameterLists
|
110
|
-
def send_payload(
|
111
|
-
logset: 'main',
|
112
|
-
msg:,
|
113
|
-
datetime: nil,
|
114
|
-
service:,
|
115
|
-
source:,
|
116
|
-
source_category:,
|
117
|
-
tags:
|
118
|
-
)
|
119
|
-
# rubocop:enable Metrics/ParameterLists
|
120
|
-
|
121
|
-
datetime = DateTime.now if datetime.nil?
|
122
|
-
|
123
|
-
# new_offset(0) is required.
|
124
|
-
# otherwise datadog will silently throws away the log..
|
125
|
-
timestamp_str = datetime.new_offset(0).rfc3339(6)
|
126
|
-
payload = create_payload(
|
127
|
-
api_key_str: build_api_key_str(api_key: @api_key, logset: logset),
|
128
|
-
msg: truncate_message(msg),
|
129
|
-
extra_content: build_extra_content(
|
130
|
-
timestamp: timestamp_str,
|
131
|
-
hostname: @hostname,
|
132
|
-
service: service,
|
133
|
-
tags_payload: build_tags_payload(
|
134
|
-
config_tags: tags,
|
135
|
-
source: source,
|
136
|
-
source_category: source_category
|
137
|
-
)
|
138
|
-
)
|
139
|
-
)
|
140
|
-
@conn.retry_on_connection_failure do
|
141
|
-
@conn.write(payload)
|
142
|
-
end
|
143
|
-
payload
|
144
|
-
end
|
145
|
-
|
146
|
-
def shutdown
|
147
|
-
@conn.close unless @conn.nil?
|
148
|
-
end
|
149
|
-
|
150
|
-
class << self
|
151
|
-
def from_env
|
152
|
-
new(api_key: ENV['DD_LOG_API_KEY'], hostname: Socket.gethostname)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
private
|
157
|
-
|
158
|
-
def init_api_client
|
159
|
-
ssl = true
|
160
|
-
ssl = { verify_mode: OpenSSL::SSL::VERIFY_NONE } if @skip_ssl_validation
|
161
|
-
server = "#{@log_dd_url}:#{@log_dd_port}"
|
162
|
-
@conn = Net::TCPClient.new(server: server, ssl: ssl)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|