logstash-output-sumologic 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a93e4aba1af87a7e0c3ea3570e5ff177e4307736dacf2fde1da78dbe4150a2da
|
4
|
+
data.tar.gz: 9ceb227f390a49467f7195daa96152335922275b714dda87215f11c16273d060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b55069b26026545a9cbb755555fa53e0570b120ea37ded4ae487da989f0054a6fb1259998a8e9eb038c0314a4450afa70fe658d372030f4eae0f25e7247b5b
|
7
|
+
data.tar.gz: 6ca3a09f3f297c87c06707dd6a3b74d8210cb46ac60dde3f2663b2509cd87274d92d67d49203194a4def5e70dd314190a4887ac9401199889ecbaf79b22bb77a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.4.1 (2022-03-09)
|
4
|
+
|
5
|
+
- [#73](https://github.com/SumoLogic/logstash-output-sumologic/pull/73) fix: remove deadlock possibility by adding resend_queue queue
|
6
|
+
|
3
7
|
## 1.4.0 (2021-09-27)
|
4
8
|
|
5
9
|
- [#68](https://github.com/SumoLogic/logstash-output-sumologic/pull/68) feat: retry on 502 error code
|
@@ -27,8 +27,8 @@ module LogStash; module Outputs; class SumoLogic;
|
|
27
27
|
end
|
28
28
|
end # def enq
|
29
29
|
|
30
|
-
def deq()
|
31
|
-
batch = @queue.deq()
|
30
|
+
def deq(non_block: false)
|
31
|
+
batch = @queue.deq(non_block: non_block)
|
32
32
|
batch_size = batch.payload.bytesize
|
33
33
|
@stats.record_deque(batch_size)
|
34
34
|
@queue_bytesize.update { |v| v - batch_size }
|
@@ -24,10 +24,14 @@ module LogStash; module Outputs; class SumoLogic;
|
|
24
24
|
@sender_max = (config["sender_max"] ||= 1) < 1 ? 1 : config["sender_max"]
|
25
25
|
@sleep_before_requeue = config["sleep_before_requeue"] ||= 30
|
26
26
|
@stats_enabled = config["stats_enabled"] ||= false
|
27
|
+
@iteration_sleep = 0.3
|
27
28
|
|
28
29
|
@tokens = SizedQueue.new(@sender_max)
|
29
30
|
@sender_max.times { |t| @tokens << t }
|
30
31
|
|
32
|
+
# Make resend_queue twice as big as sender_max,
|
33
|
+
# because if one batch is processed, the next one is already waiting in the thread
|
34
|
+
@resend_queue = SizedQueue.new(2*@sender_max)
|
31
35
|
@compressor = LogStash::Outputs::SumoLogic::Compressor.new(config)
|
32
36
|
|
33
37
|
end # def initialize
|
@@ -39,9 +43,24 @@ module LogStash; module Outputs; class SumoLogic;
|
|
39
43
|
@stopping.make_false()
|
40
44
|
@sender_t = Thread.new {
|
41
45
|
while @stopping.false?
|
42
|
-
|
46
|
+
begin
|
47
|
+
# Resend batch if any in the queue
|
48
|
+
batch = @resend_queue.deq(non_block: true)
|
49
|
+
rescue ThreadError
|
50
|
+
# send new batch otherwise
|
51
|
+
begin
|
52
|
+
batch = @queue.deq(non_block: true)
|
53
|
+
rescue ThreadError
|
54
|
+
Stud.stoppable_sleep(@iteration_sleep) { @stopping.true? }
|
55
|
+
next
|
56
|
+
end
|
57
|
+
end
|
43
58
|
send_request(batch)
|
44
59
|
end # while
|
60
|
+
@resend_queue.size.times.map { |queue|
|
61
|
+
batch = queue.deq()
|
62
|
+
send_request(batch)
|
63
|
+
}
|
45
64
|
@queue.drain().map { |batch|
|
46
65
|
send_request(batch)
|
47
66
|
}
|
@@ -98,6 +117,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
98
117
|
return
|
99
118
|
end
|
100
119
|
|
120
|
+
# wait for token so we do not exceed number of request in background
|
101
121
|
token = @tokens.pop()
|
102
122
|
|
103
123
|
if @stats_enabled && content.start_with?(STATS_TAG)
|
@@ -111,11 +131,9 @@ module LogStash; module Outputs; class SumoLogic;
|
|
111
131
|
:content_size => content.size,
|
112
132
|
:content => content[0..20],
|
113
133
|
:payload_size => body.size)
|
134
|
+
|
135
|
+
# send request in background
|
114
136
|
request = @client.send(:background).send(:post, @url, :body => body, :headers => headers)
|
115
|
-
|
116
|
-
request.on_complete do
|
117
|
-
@tokens << token
|
118
|
-
end
|
119
137
|
|
120
138
|
request.on_success do |response|
|
121
139
|
@stats.record_response_success(response.code)
|
@@ -126,12 +144,16 @@ module LogStash; module Outputs; class SumoLogic;
|
|
126
144
|
:headers => headers,
|
127
145
|
:contet => content[0..20])
|
128
146
|
if response.code == 429 || response.code == 502 || response.code == 503 || response.code == 504
|
147
|
+
# requeue and release token
|
129
148
|
requeue_message(batch)
|
149
|
+
@tokens << token
|
130
150
|
end
|
131
151
|
else
|
132
152
|
log_dbg("request accepted",
|
133
153
|
:token => token,
|
134
154
|
:code => response.code)
|
155
|
+
# release token
|
156
|
+
@tokens << token
|
135
157
|
end
|
136
158
|
end
|
137
159
|
|
@@ -143,6 +165,8 @@ module LogStash; module Outputs; class SumoLogic;
|
|
143
165
|
:class => exception.class.name,
|
144
166
|
:backtrace => exception.backtrace)
|
145
167
|
requeue_message(batch)
|
168
|
+
# requeue and release token
|
169
|
+
@tokens << token
|
146
170
|
end
|
147
171
|
|
148
172
|
@stats.record_request(content.bytesize, body.bytesize)
|
@@ -162,7 +186,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
162
186
|
:content => content[0..20],
|
163
187
|
:headers => batch.headers)
|
164
188
|
Stud.stoppable_sleep(@sleep_before_requeue) { @stopping.true? }
|
165
|
-
@
|
189
|
+
@resend_queue.enq(batch)
|
166
190
|
end
|
167
191
|
end # def reque_message
|
168
192
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-sumologic'
|
3
|
-
s.version = '1.4.
|
3
|
+
s.version = '1.4.1'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Deliever the log to Sumo Logic cloud service.'
|
6
6
|
s.description = 'This gem is a Logstash output plugin to deliver the log or metrics to Sumo Logic cloud service. Go to https://github.com/SumoLogic/logstash-output-sumologic for getting help, reporting issues, etc.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-sumologic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sumo Logic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: manticore
|