fluent-plugin-sumologic_output 1.3.2 → 1.4.0

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
  SHA1:
3
- metadata.gz: 89b0eebb156a64156ad58009ff550b01d9f78aa3
4
- data.tar.gz: c49627b56d91fc0e1e51e7facab6d1d2e04e1a4f
3
+ metadata.gz: 129fc1c24fc6e1ac2b446b80fdfc7ac5165b7986
4
+ data.tar.gz: b9f01bee4b86185e306c7155c228a54cde730145
5
5
  SHA512:
6
- metadata.gz: 72a0fd6a22f47a28224db09a27fe1e860d6625736e53a48b70dc8c02904ded8c592e570335ca49c3e43db598355a2dfee05215469086eb133bc9661c84885981
7
- data.tar.gz: ec2c811665dd7587e459960f574ead7de4b32f4289bb124d2d7d071242abfa93b5d374860c4fb477b9efb2e9b5719d7cdb47dff3685b1b647d2cd7cc78b72b63
6
+ metadata.gz: e64e61a98fd1a39122b11661cdd3dd03507a0f5968700f69042604ff26ff0eb34d4d8095b46390fbc30d758570314b8b346b105a3affb9c4b63164b50a0ee953
7
+ data.tar.gz: 1b41b319196744540f98839e5f6d04d670fbfa492b31d6594868c76e193bf075f7c78eb180494b5e69bf1306bb174f8ab78f34cbd24ff841f681e33c12206063
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. Tracking did not begin until version 1.10.
4
4
 
5
+ <a name="1.4.0"></a>
6
+ # [1.4.0] (2019-01-16)
7
+
8
+ * [Add timestamp_key, prefer log message when merging](https://github.com/SumoLogic/fluentd-output-sumologic/pull/37)
9
+
10
+ <a name="1.3.2"></a>
11
+ # [1.3.2] (2018-12-05)
12
+
13
+ * Fix verify SSL bug
14
+
5
15
  <a name="1.3.1"></a>
6
16
  # [1.3.1] (2018-08-30)
7
17
 
data/README.md CHANGED
@@ -31,7 +31,8 @@ Configuration options for fluent.conf are:
31
31
  * json_merge - Same as json but merge content of `log_key` into the top level and strip `log_key`
32
32
  * `log_key` - Used to specify the key when merging json or sending logs in text format (default `message`)
33
33
  * `open_timeout` - Set timeout seconds to wait until connection is opened.
34
- * `add_timestamp` - Add `timestamp` field to logs before sending to sumologic (default `true`)
34
+ * `add_timestamp` - Add `timestamp` (or `timestamp_key`) field to logs before sending to sumologic (default `true`)
35
+ * `timestamp_key` - Field name when `add_timestamp` is on (default `timestamp`)
35
36
  * `proxy_uri` - Add the `uri` of the `proxy` environment if present.
36
37
  * `metric_data_format` - The format of metrics you will be sending, either `graphite` or `carbon2` (Default is `graphite `)
37
38
  * `disable_cookies` - Option to disable cookies on the HTTP Client. (Default is `false `)
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "fluent-plugin-sumologic_output"
7
- gem.version = "1.3.2 "
7
+ gem.version = "1.4.0"
8
8
  gem.authors = ["Steven Adams", "Frank Reno"]
9
9
  gem.email = ["stevezau@gmail.com", "frank.reno@me.com"]
10
10
  gem.description = %q{Output plugin to SumoLogic HTTP Endpoint}
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.required_ruby_version = '>= 2.0.0'
22
22
 
23
- gem.add_development_dependency "bundler", "~> 1.3"
23
+ gem.add_development_dependency "bundler", "~> 2"
24
24
  gem.add_development_dependency "rake"
25
25
  gem.add_development_dependency 'test-unit', '~> 3.1.0'
26
26
  gem.add_development_dependency "codecov", ">= 0.1.10"
@@ -80,6 +80,7 @@ class Fluent::Plugin::Sumologic < Fluent::Plugin::Output
80
80
  config_param :delimiter, :string, :default => "."
81
81
  config_param :open_timeout, :integer, :default => 60
82
82
  config_param :add_timestamp, :bool, :default => true
83
+ config_param :timestamp_key, :string, :default => 'timestamp'
83
84
  config_param :proxy_uri, :string, :default => nil
84
85
  config_param :disable_cookies, :bool, :default => false
85
86
 
@@ -145,7 +146,7 @@ class Fluent::Plugin::Sumologic < Fluent::Plugin::Output
145
146
  log = record[@log_key].strip
146
147
  if log[0].eql?('{') && log[-1].eql?('}')
147
148
  begin
148
- record = JSON.parse(log).merge(record)
149
+ record = record.merge(JSON.parse(log))
149
150
  record.delete(@log_key)
150
151
  rescue JSON::ParserError
151
152
  # do nothing, ignore
@@ -255,12 +256,12 @@ class Fluent::Plugin::Sumologic < Fluent::Plugin::Output
255
256
  end
256
257
  when 'json_merge'
257
258
  if @add_timestamp
258
- record = { :timestamp => sumo_timestamp(time) }.merge(record)
259
+ record = { @timestamp_key => sumo_timestamp(time) }.merge(record)
259
260
  end
260
261
  log = dump_log(merge_json(record))
261
262
  else
262
263
  if @add_timestamp
263
- record = { :timestamp => sumo_timestamp(time) }.merge(record)
264
+ record = { @timestamp_key => sumo_timestamp(time) }.merge(record)
264
265
  end
265
266
  log = dump_log(record)
266
267
  end
@@ -69,6 +69,7 @@ class SumologicOutput < Test::Unit::TestCase
69
69
  assert_equal instance.delimiter, '.'
70
70
  assert_equal instance.open_timeout, 60
71
71
  assert_equal instance.add_timestamp, true
72
+ assert_equal instance.timestamp_key, 'timestamp'
72
73
  assert_equal instance.proxy_uri, nil
73
74
  assert_equal instance.disable_cookies, false
74
75
  end
@@ -174,7 +175,28 @@ class SumologicOutput < Test::Unit::TestCase
174
175
  end
175
176
  assert_requested :post, "https://collectors.sumologic.com/v1/receivers/http/1234",
176
177
  headers: {'X-Sumo-Category'=>'test', 'X-Sumo-Client'=>'fluentd-output', 'X-Sumo-Host'=>'test', 'X-Sumo-Name'=>'test'},
177
- body: /\A{"foo2":"bar2","timestamp":\d+,"foo":"bar"}\z/,
178
+ body: /\A{"timestamp":\d+,"foo":"bar","foo2":"bar2"}\z/,
179
+ times:1
180
+ end
181
+
182
+ def test_emit_json_merge_timestamp
183
+ config = %{
184
+ endpoint https://collectors.sumologic.com/v1/receivers/http/1234
185
+ log_format json_merge
186
+ source_category test
187
+ source_host test
188
+ source_name test
189
+
190
+ }
191
+ driver = create_driver(config)
192
+ time = event_time
193
+ stub_request(:post, 'https://collectors.sumologic.com/v1/receivers/http/1234')
194
+ driver.run do
195
+ driver.feed("output.test", time, {'message' => '{"timestamp":123}'})
196
+ end
197
+ assert_requested :post, "https://collectors.sumologic.com/v1/receivers/http/1234",
198
+ headers: {'X-Sumo-Category'=>'test', 'X-Sumo-Client'=>'fluentd-output', 'X-Sumo-Host'=>'test', 'X-Sumo-Name'=>'test'},
199
+ body: /\A{"timestamp":123}\z/,
178
200
  times:1
179
201
  end
180
202
 
@@ -221,6 +243,27 @@ class SumologicOutput < Test::Unit::TestCase
221
243
  times:1
222
244
  end
223
245
 
246
+ def test_emit_json_timestamp_key
247
+ config = %{
248
+ endpoint https://collectors.sumologic.com/v1/receivers/http/1234
249
+ log_format json
250
+ source_category test
251
+ source_host test
252
+ source_name test
253
+ timestamp_key ts
254
+ }
255
+ driver = create_driver(config)
256
+ time = event_time
257
+ stub_request(:post, 'https://collectors.sumologic.com/v1/receivers/http/1234')
258
+ driver.run do
259
+ driver.feed("output.test", time, {'message' => 'test'})
260
+ end
261
+ assert_requested :post, "https://collectors.sumologic.com/v1/receivers/http/1234",
262
+ headers: {'X-Sumo-Category'=>'test', 'X-Sumo-Client'=>'fluentd-output', 'X-Sumo-Host'=>'test', 'X-Sumo-Name'=>'test'},
263
+ body: /\A{"ts":\d+.,"message":"test"}\z/,
264
+ times:1
265
+ end
266
+
224
267
  def test_emit_graphite
225
268
  config = %{
226
269
  endpoint https://collectors.sumologic.com/v1/receivers/http/1234
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sumologic_output
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Adams
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-12-06 00:00:00.000000000 Z
12
+ date: 2019-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.3'
20
+ version: '2'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.3'
27
+ version: '2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.5.2.3
137
+ rubygems_version: 2.6.11
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Output plugin to SumoLogic HTTP Endpoint