logstash-output-datadog_logs 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/lib/logstash/outputs/datadog_logs.rb +37 -34
- data/logstash-output-datadog_logs.gemspec +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '08332207f354cf7e2c4a6d323fd7d9641622b1a0f3d458117d229506011ce719'
|
4
|
+
data.tar.gz: 108516196622ab56ef6b9c86c891bb68ebd80947897ed2dc1d8e8c23893fb50c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ace4d38fa8fdda5b0d0722a3536bc39964366e41ac51fdedf9ddd2588fed2bbdc15bb9eea6ebdec1b33394faf3e3f15c72a2750f320d886782a6dd53b7f09bf
|
7
|
+
data.tar.gz: 36c241db3336f385aff44926ac495ad1f2c4599b756490c4195418244054589aac6b30c87411dbd3873c6cd7ce6f20ba48bd733d890c538b8a43a0c7a0969887
|
data/README.md
CHANGED
@@ -15,60 +15,63 @@ class LogStash::Outputs::DatadogLogs < LogStash::Outputs::Base
|
|
15
15
|
|
16
16
|
default :codec, "json"
|
17
17
|
|
18
|
-
#
|
19
|
-
config :api_key,
|
18
|
+
# Datadog configuration parameters
|
19
|
+
config :api_key, :validate => :string, :required => true
|
20
|
+
config :host, :validate => :string, :required => true, :default => 'intake.logs.datadoghq.com'
|
21
|
+
config :port, :validate => :number, :required => true, :default => 10516
|
22
|
+
config :use_ssl, :validate => :boolean, :required => true, :default => true
|
23
|
+
config :max_backoff, :validate => :number, :required => true, :default => 30
|
24
|
+
config :max_retries, :validate => :number, :required => true, :default => 5
|
20
25
|
|
21
26
|
public
|
22
27
|
def register
|
23
28
|
require "socket"
|
24
|
-
|
25
|
-
@port = 10516
|
26
|
-
|
27
|
-
client_socket = nil
|
29
|
+
client = nil
|
28
30
|
@codec.on_event do |event, payload|
|
29
|
-
|
31
|
+
retries = 0
|
30
32
|
begin
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
if retries < max_retries
|
34
|
+
if retries > 0
|
35
|
+
backoff = 2 ** retries
|
36
|
+
backoff = max_backoff unless backoff < max_backoff
|
37
|
+
sleep backoff
|
38
|
+
end
|
39
|
+
client ||= new_client
|
36
40
|
message = "#{@api_key} #{payload}\n"
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
client.write(message)
|
42
|
+
else
|
43
|
+
@logger.warn("Max number of retries reached, dropping the payload", :payload => payload)
|
44
|
+
end
|
40
45
|
rescue => e
|
41
46
|
# close connection and always retry
|
42
|
-
@logger.warn("
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
@logger.warn("Could not send message, retrying", :exception => e, :backtrace => e.backtrace)
|
48
|
+
client.close rescue nil
|
49
|
+
client = nil
|
50
|
+
retries += 1
|
46
51
|
retry
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
50
55
|
|
51
56
|
public
|
52
57
|
def receive(event)
|
53
58
|
# handle new event
|
54
59
|
@codec.encode(event)
|
55
|
-
end
|
60
|
+
end
|
56
61
|
|
57
62
|
private
|
58
|
-
def
|
63
|
+
def new_client
|
59
64
|
# open a secure connection with Datadog
|
60
|
-
|
65
|
+
if @use_ssl
|
66
|
+
@logger.info("Starting SSL connection", :host => @host, :port => @port)
|
61
67
|
socket = TCPSocket.new @host, @port
|
62
68
|
sslSocket = OpenSSL::SSL::SSLSocket.new socket
|
63
69
|
sslSocket.connect
|
64
|
-
@logger.debug("Started SSL connection", :host => @host)
|
65
70
|
return sslSocket
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end # begin
|
72
|
-
end # def new_client_socket
|
71
|
+
else
|
72
|
+
@logger.info("Starting plaintext connection", :host => @host, :port => @port)
|
73
|
+
return TCPSocket.new @host, @port
|
74
|
+
end
|
75
|
+
end
|
73
76
|
|
74
|
-
end
|
77
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-datadog_logs'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.3.0'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'DatadogLogs lets you send logs to Datadog based on LogStash events.'
|
6
6
|
s.homepage = 'https://www.datadoghq.com/'
|
metadata
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-datadog_logs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog
|
8
8
|
- Alexandre Jacquemot
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: logstash-core-plugin-api
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: '2.0'
|
21
|
-
|
20
|
+
name: logstash-core-plugin-api
|
22
21
|
prerelease: false
|
22
|
+
type: :runtime
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '2.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name: logstash-devutils
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
33
|
version: '0'
|
35
|
-
|
34
|
+
name: logstash-devutils
|
36
35
|
prerelease: false
|
36
|
+
type: :development
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
-
description:
|
42
|
+
description:
|
43
43
|
email: support@datadoghq.com
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
@@ -60,7 +60,7 @@ licenses:
|
|
60
60
|
metadata:
|
61
61
|
logstash_plugin: 'true'
|
62
62
|
logstash_group: output
|
63
|
-
post_install_message:
|
63
|
+
post_install_message:
|
64
64
|
rdoc_options: []
|
65
65
|
require_paths:
|
66
66
|
- lib
|
@@ -75,9 +75,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
80
|
-
signing_key:
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.6.13
|
80
|
+
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: DatadogLogs lets you send logs to Datadog based on LogStash events.
|
83
83
|
test_files:
|