logstash-output-sumologic 1.1.2 → 1.1.3

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
- SHA256:
3
- metadata.gz: ba5807e120c5eda6d21c3bb9a424a6ac8bb3fed2c183d88cb261f282e63199e5
4
- data.tar.gz: 44b192d5ad18f126deb26da88d1a1e4a063df4fbf4a8acc09704ced09b39b87d
2
+ SHA1:
3
+ metadata.gz: b6d9bc4c2957d756a60ef1aeab7f037e7ce17b4a
4
+ data.tar.gz: 9e2fee37103045a75c2a9d1d226ccfd7a6b34377
5
5
  SHA512:
6
- metadata.gz: 4a863488145756c41cdfb8570fc44cceefa9d3f1457a03516805cd431eba1b3892548fdc90a95902c74159d239fe55f39eddba43e22594692070e583da5d87bb
7
- data.tar.gz: c5218fa63f2f21bf2376d5555d8f7a4e7ac9cb3db532ef659aafa63ee4f2f1312d6d6be47947c5455fd48728f31437348eba66ead7c1259cbb538551a1fdfcda
6
+ metadata.gz: 3f98566dfe28f2df44735658f0f92670498b956e707b82213b5b750f12c014e6ad92b466d6f38edba1c6ceec9034d68f1c2c3b3875041093daace936854a0f84
7
+ data.tar.gz: a6b18a26bdf395dc9d6ac87fba8da40cedf4a0d0aad38d3046a590089225e44359c86179469cdcd321ef79f6c00ef40ed8c2c004d2d50b8e1a8ad5719d788a6b
@@ -7,6 +7,7 @@ require 'thread'
7
7
  require "uri"
8
8
  require "zlib"
9
9
  require "stringio"
10
+ require "socket"
10
11
 
11
12
  # Now you can use logstash to deliver logs to Sumo Logic
12
13
  #
@@ -101,7 +102,7 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
101
102
 
102
103
  public
103
104
  def register
104
- @source_host = `hostname`.strip unless @source_host
105
+ @source_host = Socket.gethostname unless @source_host
105
106
 
106
107
  # initialize request pool
107
108
  @request_tokens = SizedQueue.new(@pool_max)
@@ -392,4 +393,4 @@ end # def dotify
392
393
  @logger.error(message, opts)
393
394
  end # def log_failure
394
395
 
395
- end # class LogStash::Outputs::SumoLogic
396
+ end # class LogStash::Outputs::SumoLogic
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "logstash-output-sumologic"
3
- s.version = "1.1.2"
3
+ s.version = "1.1.3"
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."
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
20
20
  # Gem dependencies
21
21
  s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
22
22
  s.add_runtime_dependency "logstash-codec-plain", ">= 0"
23
- s.add_development_dependency "logstash-devutils", "~> 0"
23
+ s.add_development_dependency "logstash-devutils", "~> 1.3", ">= 1.3.1"
24
24
  end
@@ -65,7 +65,9 @@ describe LogStash::Outputs::SumoLogic do
65
65
 
66
66
  context "log sent with customized json_mapping" do
67
67
 
68
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "format" => "%{host} %{@json}", "json_mapping" => { "foo" => "%{foo}", "bar" => "%{bar}", "%{foo}" => "%{bar}" } ) }
68
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
69
+ "format" => "%{host} %{@json}",
70
+ "json_mapping" => { "foo" => "%{foo}", "bar" => "%{bar}", "%{foo}" => "%{bar}" } ) }
69
71
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "bar" => 24) }
70
72
 
71
73
  it "generate one element" do
@@ -96,7 +98,10 @@ describe LogStash::Outputs::SumoLogic do
96
98
  let(:event) { LogStash::Event.new("host" => "myHost", "message" => "Hello world") }
97
99
 
98
100
  it "check header" do
99
- expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip, "X-Sumo-Client"=>"logstash-output-sumologic", "Content-Type"=>"text/plain", "X-Sumo-Category"=>"my source category"})
101
+ expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip,
102
+ "X-Sumo-Client"=>"logstash-output-sumologic",
103
+ "Content-Type"=>"text/plain",
104
+ "X-Sumo-Category"=>"my source category"})
100
105
  end
101
106
 
102
107
  end
@@ -107,7 +112,10 @@ describe LogStash::Outputs::SumoLogic do
107
112
  let(:event) { LogStash::Event.new("host" => "myHost", "message" => "Hello world") }
108
113
 
109
114
  it "check header" do
110
- expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip, "X-Sumo-Client"=>"logstash-output-sumologic", "Content-Type"=>"text/plain", "X-Sumo-Name"=>"my source name"})
115
+ expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip,
116
+ "X-Sumo-Client"=>"logstash-output-sumologic",
117
+ "Content-Type"=>"text/plain",
118
+ "X-Sumo-Name"=>"my source name"})
111
119
  end
112
120
 
113
121
  end
@@ -140,7 +148,10 @@ describe LogStash::Outputs::SumoLogic do
140
148
  let(:event) { LogStash::Event.new("host" => "myHost", "message" => "Hello world") }
141
149
 
142
150
  it "check header" do
143
- expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip, "X-Sumo-Client"=>"logstash-output-sumologic", "Content-Type"=>"text/plain", "Content-Encoding"=>"deflate"})
151
+ expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip,
152
+ "X-Sumo-Client"=>"logstash-output-sumologic",
153
+ "Content-Type"=>"text/plain",
154
+ "Content-Encoding"=>"deflate"})
144
155
  end
145
156
 
146
157
  end
@@ -151,7 +162,10 @@ describe LogStash::Outputs::SumoLogic do
151
162
  let(:event) { LogStash::Event.new("host" => "myHost", "message" => "Hello world") }
152
163
 
153
164
  it "check header" do
154
- expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip, "X-Sumo-Client"=>"logstash-output-sumologic", "Content-Type"=>"text/plain", "Content-Encoding"=>"gzip"})
165
+ expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip,
166
+ "X-Sumo-Client"=>"logstash-output-sumologic",
167
+ "Content-Type"=>"text/plain",
168
+ "Content-Encoding"=>"gzip"})
155
169
  end
156
170
 
157
171
  end
@@ -159,7 +173,9 @@ describe LogStash::Outputs::SumoLogic do
159
173
  # For metrics
160
174
  context "with metrics sent in graphite" do
161
175
 
162
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "metrics" => { "hurray.%{foo}" => "%{bar}"}, "metrics_format" => "graphite") }
176
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
177
+ "metrics" => { "hurray.%{foo}" => "%{bar}"},
178
+ "metrics_format" => "graphite") }
163
179
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "bar" => 24) }
164
180
 
165
181
  it "generate one element" do
@@ -167,7 +183,9 @@ describe LogStash::Outputs::SumoLogic do
167
183
  end
168
184
 
169
185
  it "check header" do
170
- expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip, "X-Sumo-Client"=>"logstash-output-sumologic", "Content-Type"=>"application/vnd.sumologic.graphite"})
186
+ expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip,
187
+ "X-Sumo-Client"=>"logstash-output-sumologic",
188
+ "Content-Type"=>"application/vnd.sumologic.graphite"})
171
189
  end
172
190
 
173
191
  it "include all content" do
@@ -185,7 +203,9 @@ describe LogStash::Outputs::SumoLogic do
185
203
  end
186
204
 
187
205
  it "check header" do
188
- expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip, "X-Sumo-Client"=>"logstash-output-sumologic", "Content-Type"=>"application/vnd.sumologic.carbon2"})
206
+ expect(server.header).to eq({"X-Sumo-Host"=>`hostname`.strip,
207
+ "X-Sumo-Client"=>"logstash-output-sumologic",
208
+ "Content-Type"=>"application/vnd.sumologic.carbon2"})
189
209
  end
190
210
 
191
211
  it "include all content" do
@@ -194,7 +214,9 @@ describe LogStash::Outputs::SumoLogic do
194
214
  end
195
215
 
196
216
  context "with metrics_name override" do
197
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "metrics" => { "hurray.%{foo}" => "%{bar}" }, "metrics_name" => "mynamespace.*") }
217
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
218
+ "metrics" => { "hurray.%{foo}" => "%{bar}" },
219
+ "metrics_name" => "mynamespace.*") }
198
220
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "bar" => 24) }
199
221
 
200
222
  it "include all content" do
@@ -203,7 +225,9 @@ describe LogStash::Outputs::SumoLogic do
203
225
  end
204
226
 
205
227
  context "with intrinsic_tags override" do
206
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "metrics" => { "bar" => "%{bar}" }, "intrinsic_tags" => {"host"=>"%{host}"}) }
228
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
229
+ "metrics" => { "bar" => "%{bar}" },
230
+ "intrinsic_tags" => {"host"=>"%{host}"}) }
207
231
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "bar" => 24) }
208
232
 
209
233
  it "include all content" do
@@ -212,7 +236,10 @@ describe LogStash::Outputs::SumoLogic do
212
236
  end
213
237
 
214
238
  context "with meta_tags override" do
215
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "metrics" => { "bar" => "%{bar}" }, "intrinsic_tags" => {"host"=>"%{host}"}, "meta_tags" => {"foo" => "%{foo}"}) }
239
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
240
+ "metrics" => { "bar" => "%{bar}" },
241
+ "intrinsic_tags" => {"host"=>"%{host}"},
242
+ "meta_tags" => {"foo" => "%{foo}"}) }
216
243
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "bar" => 24) }
217
244
 
218
245
  it "include all content" do
@@ -221,39 +248,52 @@ describe LogStash::Outputs::SumoLogic do
221
248
  end
222
249
 
223
250
  context "with multiple metrics mapping" do
224
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "metrics" => { "cpu1" => "%{cpu1}", "cpu2" => "%{cpu2}" }, "intrinsic_tags" => {"host"=>"%{host}"}, "meta_tags" => {"foo" => "%{foo}"}) }
251
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
252
+ "metrics" => { "cpu1" => "%{cpu1}", "cpu2" => "%{cpu2}" },
253
+ "intrinsic_tags" => {"host"=>"%{host}"},
254
+ "meta_tags" => {"foo" => "%{foo}"}) }
225
255
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "cpu1" => 0.24, "cpu2" => 0.11) }
226
256
 
227
257
  it "include content" do
228
- expect(server.pop).to match(/^host=myHost metric=cpu1 foo=fancy 0\.24 \d{10,}$/)
229
- expect(server.pop).to match(/^host=myHost metric=cpu2 foo=fancy 0\.11 \d{10,}$/)
258
+ sorted = server.all_sorted
259
+ expect(sorted.pop).to match(/^host=myHost metric=cpu1 foo=fancy 0\.24 \d{10,}$/)
260
+ expect(sorted.pop).to match(/^host=myHost metric=cpu2 foo=fancy 0\.11 \d{10,}$/)
230
261
  end
231
262
  end
232
263
 
233
264
  context "metrics with non-number value should be dropped (carbon2)" do
234
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "metrics" => { "cpu1" => "%{cpu1}", "cpu2" => "%{cpu2}", "cpu3" => "%{cpu3}" }, "intrinsic_tags" => {"host"=>"%{host}"}, "meta_tags" => {"foo" => "%{foo}"}) }
265
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
266
+ "metrics" => { "cpu1" => "%{cpu1}", "cpu2" => "%{cpu2}", "cpu3" => "%{cpu3}" },
267
+ "intrinsic_tags" => {"host"=>"%{host}"}, "meta_tags" => {"foo" => "%{foo}"}) }
235
268
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "cpu1" => 0.24, "cpu2" => "abc", "cpu3" => 0.11) }
236
269
 
237
270
  it "include content" do
238
- expect(server.pop).to match(/^host=myHost metric=cpu1 foo=fancy 0\.24 \d{10,}$/)
239
- expect(server.pop).to match(/^host=myHost metric=cpu3 foo=fancy 0\.11 \d{10,}$/)
240
- expect(server.empty?).to eq(true)
271
+ sorted = server.all_sorted
272
+ expect(sorted.pop).to match(/^host=myHost metric=cpu1 foo=fancy 0\.24 \d{10,}$/)
273
+ expect(sorted.pop).to match(/^host=myHost metric=cpu3 foo=fancy 0\.11 \d{10,}$/)
274
+ expect(sorted.empty?).to eq(true)
241
275
  end
242
276
  end
243
277
 
244
278
  context "metrics with non-number value should be dropped (graphite)" do
245
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "metrics" => { "cpu1" => "%{cpu1}", "cpu2" => "%{cpu2}", "cpu3" => "%{cpu3}" }, "metrics_format" => "graphite") }
279
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
280
+ "metrics" => { "cpu1" => "%{cpu1}", "cpu2" => "%{cpu2}", "cpu3" => "%{cpu3}" },
281
+ "metrics_format" => "graphite") }
246
282
  let(:event) { LogStash::Event.new("host" => "myHost", "foo" => "fancy", "cpu1" => 0.24, "cpu2" => "abc", "cpu3" => 0.11) }
247
283
 
248
284
  it "include content" do
249
- expect(server.pop).to match(/^cpu1 0\.24 \d{10,}$/)
250
- expect(server.pop).to match(/^cpu3 0\.11 \d{10,}$/)
251
- expect(server.empty?).to eq(true)
285
+ sorted = server.all_sorted
286
+ expect(sorted.pop).to match(/^cpu1 0\.24 \d{10,}$/)
287
+ expect(sorted.pop).to match(/^cpu3 0\.11 \d{10,}$/)
288
+ expect(sorted.empty?).to eq(true)
252
289
  end
253
290
  end
254
291
 
255
292
  context "fields_as_metrics (carbon2)" do
256
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "fields_as_metrics" => true, "intrinsic_tags" => {"host"=>"%{host}"}, "meta_tags" => {"foo" => "%{foo}"}) }
293
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
294
+ "fields_as_metrics" => true,
295
+ "intrinsic_tags" => {"host"=>"%{host}"},
296
+ "meta_tags" => {"foo" => "%{foo}"}) }
257
297
  let(:event) { LogStash::Event.new(
258
298
  "host" => "myHost",
259
299
  "foo" => "fancy",
@@ -267,15 +307,16 @@ describe LogStash::Outputs::SumoLogic do
267
307
  })}
268
308
 
269
309
  it "include content" do
270
- expect(server.pop).to match(/^host=myHost metric=blkio\.write_ps foo=fancy 5 \d{10,}$/)
271
- expect(server.pop).to match(/^host=myHost metric=blkio\.read_ps foo=fancy 2 \d{10,}$/)
272
- expect(server.pop).to match(/^host=myHost metric=blkio\.total_ps foo=fancy 0 \d{10,}$/)
273
- expect(server.pop).to match(/^host=myHost metric=cpu\.0 foo=fancy 0\.24 \d{10,}$/)
274
- expect(server.pop).to match(/^host=myHost metric=cpu\.1 foo=fancy 0\.11 \d{10,}$/)
275
- expect(server.pop).to match(/^host=myHost metric=cpu\.2 foo=fancy 0\.75 \d{10,}$/)
276
- expect(server.pop).to match(/^host=myHost metric=cpu\.3 foo=fancy 0\.28 \d{10,}$/)
277
- expect(server.pop).to match(/^host=myHost metric=storageRW foo=fancy 51 \d{10,}$/)
278
- expect(server.empty?).to eq(true)
310
+ sorted = server.all_sorted
311
+ expect(sorted.pop).to match(/^host=myHost metric=blkio\.read_ps foo=fancy 2 \d{10,}$/)
312
+ expect(sorted.pop).to match(/^host=myHost metric=blkio\.total_ps foo=fancy 0 \d{10,}$/)
313
+ expect(sorted.pop).to match(/^host=myHost metric=blkio\.write_ps foo=fancy 5 \d{10,}$/)
314
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.0 foo=fancy 0\.24 \d{10,}$/)
315
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.1 foo=fancy 0\.11 \d{10,}$/)
316
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.2 foo=fancy 0\.75 \d{10,}$/)
317
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.3 foo=fancy 0\.28 \d{10,}$/)
318
+ expect(sorted.pop).to match(/^host=myHost metric=storageRW foo=fancy 51 \d{10,}$/)
319
+ expect(sorted.empty?).to eq(true)
279
320
  end
280
321
  end
281
322
 
@@ -294,19 +335,24 @@ describe LogStash::Outputs::SumoLogic do
294
335
  })}
295
336
 
296
337
  it "include content" do
297
- expect(server.pop).to match(/^blkio.write_ps 0 \d{10,}$/)
298
- expect(server.pop).to match(/^blkio.read_ps 0 \d{10,}$/)
299
- expect(server.pop).to match(/^blkio.total_ps 0 \d{10,}$/)
300
- expect(server.pop).to match(/^cpu\.0 0\.24 \d{10,}$/)
301
- expect(server.pop).to match(/^cpu\.1 0\.11 \d{10,}$/)
302
- expect(server.pop).to match(/^cpu\.2 0\.75 \d{10,}$/)
303
- expect(server.pop).to match(/^cpu\.3 0\.28 \d{10,}$/)
304
- expect(server.pop).to match(/^storageRW 51 \d{10,}$/)
338
+ sorted = server.all_sorted
339
+ expect(sorted.pop).to match(/^blkio\.read_ps 0 \d{10,}$/)
340
+ expect(sorted.pop).to match(/^blkio\.total_ps 0 \d{10,}$/)
341
+ expect(sorted.pop).to match(/^blkio\.write_ps 0 \d{10,}$/)
342
+ expect(sorted.pop).to match(/^cpu\.0 0\.24 \d{10,}$/)
343
+ expect(sorted.pop).to match(/^cpu\.1 0\.11 \d{10,}$/)
344
+ expect(sorted.pop).to match(/^cpu\.2 0\.75 \d{10,}$/)
345
+ expect(sorted.pop).to match(/^cpu\.3 0\.28 \d{10,}$/)
346
+ expect(sorted.pop).to match(/^storageRW 51 \d{10,}$/)
305
347
  end
306
348
  end
307
349
 
308
350
  context "fields_include is honored when fields_as_metrics (carbon2)" do
309
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "fields_as_metrics" => true, "intrinsic_tags" => {"host"=>"%{host}"}, "meta_tags" => {"foo" => "%{foo}"}, "fields_include" => ["cpu*"]) }
351
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
352
+ "fields_as_metrics" => true,
353
+ "intrinsic_tags" => {"host"=>"%{host}"},
354
+ "meta_tags" => {"foo" => "%{foo}"},
355
+ "fields_include" => ["cpu*"]) }
310
356
  let(:event) { LogStash::Event.new(
311
357
  "host" => "myHost",
312
358
  "foo" => "fancy",
@@ -320,16 +366,22 @@ describe LogStash::Outputs::SumoLogic do
320
366
  })}
321
367
 
322
368
  it "include content" do
323
- expect(server.pop).to match(/^host=myHost metric=cpu\.0 foo=fancy 0\.24 \d{10,}$/)
324
- expect(server.pop).to match(/^host=myHost metric=cpu\.1 foo=fancy 0\.11 \d{10,}$/)
325
- expect(server.pop).to match(/^host=myHost metric=cpu\.2 foo=fancy 0\.75 \d{10,}$/)
326
- expect(server.pop).to match(/^host=myHost metric=cpu\.3 foo=fancy 0\.28 \d{10,}$/)
327
- expect(server.empty?).to eq(true)
369
+ sorted = server.all_sorted
370
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.0 foo=fancy 0\.24 \d{10,}$/)
371
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.1 foo=fancy 0\.11 \d{10,}$/)
372
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.2 foo=fancy 0\.75 \d{10,}$/)
373
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.3 foo=fancy 0\.28 \d{10,}$/)
374
+ expect(sorted.empty?).to eq(true)
328
375
  end
329
376
  end
330
377
 
331
378
  context "fields_exclude is honored when fields_as_metrics (carbon2)" do
332
- subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234", "fields_as_metrics" => true, "intrinsic_tags" => {"host"=>"%{host}"}, "meta_tags" => {"foo" => "%{foo}"}, "fields_include" => ["cpu*"], "fields_exclude" => [".*1"]) }
379
+ subject { LogStash::Outputs::SumoLogic.new("url" => "http://localhost/1234",
380
+ "fields_as_metrics" => true,
381
+ "intrinsic_tags" => {"host"=>"%{host}"},
382
+ "meta_tags" => {"foo" => "%{foo}"},
383
+ "fields_include" => ["cpu*"],
384
+ "fields_exclude" => [".*1"]) }
333
385
  let(:event) { LogStash::Event.new(
334
386
  "host" => "myHost",
335
387
  "foo" => "fancy",
@@ -343,10 +395,11 @@ describe LogStash::Outputs::SumoLogic do
343
395
  })}
344
396
 
345
397
  it "include content" do
346
- expect(server.pop).to match(/^host=myHost metric=cpu\.0 foo=fancy 0\.24 \d{10,}$/)
347
- expect(server.pop).to match(/^host=myHost metric=cpu\.2 foo=fancy 0\.75 \d{10,}$/)
348
- expect(server.pop).to match(/^host=myHost metric=cpu\.3 foo=fancy 0\.28 \d{10,}$/)
349
- expect(server.empty?).to eq(true)
398
+ sorted = server.all_sorted
399
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.0 foo=fancy 0\.24 \d{10,}$/)
400
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.2 foo=fancy 0\.75 \d{10,}$/)
401
+ expect(sorted.pop).to match(/^host=myHost metric=cpu\.3 foo=fancy 0\.28 \d{10,}$/)
402
+ expect(sorted.empty?).to eq(true)
350
403
  end
351
404
  end
352
405
 
data/spec/spec_helper.rb CHANGED
@@ -14,6 +14,14 @@ class Server
14
14
  @queue.length
15
15
  end
16
16
 
17
+ def all
18
+ @queue.size.times.map { @queue.pop }
19
+ end
20
+
21
+ def all_sorted
22
+ all.sort { |x, y| y <=> x }
23
+ end
24
+
17
25
  def pop
18
26
  if !@queue.empty?
19
27
  @queue.pop
@@ -50,4 +58,4 @@ class LogStash::Outputs::SumoLogic
50
58
  @server.push(content, get_headers())
51
59
  end
52
60
 
53
- end
61
+ end
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.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sumo Logic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-09 00:00:00.000000000 Z
11
+ date: 2018-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -43,7 +43,10 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '1.3'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.3.1
47
50
  name: logstash-devutils
48
51
  prerelease: false
49
52
  type: :development
@@ -51,7 +54,10 @@ dependencies:
51
54
  requirements:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
- version: '0'
57
+ version: '1.3'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.3.1
55
61
  description: This gem is a Logstash output plugin to deliver the log or metrics to
56
62
  Sumo Logic cloud service. Go to https://github.com/SumoLogic/logstash-output-sumologic
57
63
  for getting help, reporting issues, etc.
@@ -93,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
99
  version: '0'
94
100
  requirements: []
95
101
  rubyforge_project:
96
- rubygems_version: 2.6.13
102
+ rubygems_version: 2.6.14.1
97
103
  signing_key:
98
104
  specification_version: 4
99
105
  summary: Deliever the log to Sumo Logic cloud service.