fluent-plugin-sumologic_output 1.1.0 → 1.1.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
- SHA256:
3
- metadata.gz: 8fd43e4a8259784985b70eaac09c43346525f61d08c0383912f6434887a9aa03
4
- data.tar.gz: 7f8a58eee2a297ca40cb7d599371040bf7225632de7dbc561710050e01d692a0
2
+ SHA1:
3
+ metadata.gz: dcbd216a8cf0562bb6f63671fce22866b5742712
4
+ data.tar.gz: d45c48d3e5ea07f541658be70d85feffd1d910e6
5
5
  SHA512:
6
- metadata.gz: e6436be0d5af2de4521319e7bee494cae41fc4b2052a54256317268ca02c2873bfc48060755ca7b361e21e69f633cca1a38aa255449ff72b21c0dfe2451b50ef
7
- data.tar.gz: 5ee85c23b49b9608754e76342508ce9d4a7df0f1a35b4a82f8686b9eafb7264f8c09d1c736c8975b5fb61fa420b9efcb016bb6790aeb6f30f54c8b5e12a73500
6
+ metadata.gz: 7fa72775f5b1d684f1b7c89b24f546faca6d764e489dd35f06300724794a81534f1948b522b909c9d7ed9d516a17b9febd60c3b47cc2b2e83fe96815bc647b58
7
+ data.tar.gz: 6512a6a8835c8f81846d5f1c90c3330435b3b9f4eec286e24cf24ea6953835b01bc571c9a827ac9af0ea7e85144d17d644aa4bcb13beeada305b850e36196b4f
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ lang: ruby
2
+
3
+ script: bundle exec rake
4
+
5
+ rvm: 2.3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
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.1.1"></a>
6
+ # [1.1.1] (2018-07-12)
7
+
8
+ * if `record[@log_key]` is json, parse it as JSON and not as string.
9
+
5
10
  <a name="1.1.0"></a>
6
11
  # [1.1.0] (2018-06-29)
7
12
 
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  group :test do
4
+ gem 'codecov'
4
5
  gem 'simplecov'
5
6
  gem 'webmock'
6
7
  end
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/SumoLogic/fluentd-output-sumologic.svg?branch=master)](https://travis-ci.org/SumoLogic/fluentd-output-sumologic) ![](https://ruby-gem-downloads-badge.herokuapp.com/fluent-plugin-sumologic_output?type=total) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/SumoLogic/fluentd-output-sumologic/issues)
2
+
1
3
  # fluent-plugin-sumologic_output, a plugin for [Fluentd](http://fluentd.org)
2
4
 
3
5
  This plugin has been designed to output logs or metrics to [SumoLogic](http://www.sumologic.com) via a [HTTP collector endpoint](http://help.sumologic.com/Send_Data/Sources/02Sources_for_Hosted_Collectors/HTTP_Source)
@@ -7,7 +9,10 @@ This plugin has been designed to output logs or metrics to [SumoLogic](http://ww
7
9
  | In keeping with industry standard security best practices, as of May 31, 2018, the Sumo Logic service will only support TLS version 1.2 going forward. Verify that all connections to Sumo Logic endpoints are made from software that supports TLS 1.2. |
8
10
 
9
11
  ## Support
10
- The code in this repository has been contributed by the Sumo Logic community and is not officially supported by Sumo Logic. For any issues or questions please submit an issue through GitHub or start a conversation within the [Sumo Logic Community](https://community.sumologic.com) forums. The maintainers of this project will work directly with the community to answer any questions, address bugs, or review any requests for new features.
12
+ The code in this repository has been developed in collaboration with the Sumo Logic community and is not supported via standard Sumo Logic Support channels. For any issues or questions please submit an issue directly on GitHub. The maintainers of this project will work directly with the community to answer any questions, address bugs, or review any requests for new features.
13
+
14
+ ## License
15
+ Released under Apache 2.0 License.
11
16
 
12
17
  ## Installation
13
18
 
@@ -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.1.0"
7
+ gem.version = "1.1.1"
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}
@@ -22,7 +22,8 @@ Gem::Specification.new do |gem|
22
22
 
23
23
  gem.add_development_dependency "bundler", "~> 1.3"
24
24
  gem.add_development_dependency "rake"
25
- gem.add_runtime_dependency "fluentd", ">= 0.14.0"
26
25
  gem.add_development_dependency 'test-unit', '~> 3.1.0'
26
+ gem.add_development_dependency "codecov", ">= 0.1.10"
27
+ gem.add_runtime_dependency "fluentd", ">= 0.14.0"
27
28
  gem.add_runtime_dependency 'httpclient', '~> 2.8.0'
28
29
  end
@@ -150,7 +150,14 @@ class Fluent::Plugin::Sumologic < Fluent::Plugin::Output
150
150
  # Strip sumo_metadata and dump to json
151
151
  def dump_log(log)
152
152
  log.delete('_sumo_metadata')
153
- Yajl.dump(log)
153
+ begin
154
+ parser = Yajl::Parser.new
155
+ hash = parser.parse(log[@log_key])
156
+ log[@log_key] = hash
157
+ Yajl.dump(log)
158
+ rescue
159
+ Yajl.dump(log)
160
+ end
154
161
  end
155
162
 
156
163
  def format(tag, time, record)
data/test/helper.rb CHANGED
@@ -1,3 +1,11 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ if ENV['CI'] == 'true'
5
+ require 'codecov'
6
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
7
+ end
8
+
1
9
  $LOAD_PATH.unshift(File.expand_path("../../", __FILE__))
2
10
  require "test-unit"
3
11
  require "fluent/test"
@@ -161,6 +161,48 @@ class SumologicOutput < Test::Unit::TestCase
161
161
  times:1
162
162
  end
163
163
 
164
+ def test_emit_json_double_encoded
165
+ config = %{
166
+ endpoint https://endpoint3.collection.us2.sumologic.com/receiver/v1/http/1234
167
+ log_format json
168
+ source_category test
169
+ source_host test
170
+ source_name test
171
+
172
+ }
173
+ driver = create_driver(config)
174
+ time = event_time
175
+ stub_request(:post, 'https://endpoint3.collection.us2.sumologic.com/receiver/v1/http/1234')
176
+ driver.run do
177
+ driver.feed("output.test", time, {'message' => '{"bar":"foo"}'})
178
+ end
179
+ assert_requested :post, "https://endpoint3.collection.us2.sumologic.com/receiver/v1/http/1234",
180
+ headers: {'X-Sumo-Category'=>'test', 'X-Sumo-Client'=>'fluentd-output', 'X-Sumo-Host'=>'test', 'X-Sumo-Name'=>'test'},
181
+ body: /\A{"timestamp":\d+.,"message":{"bar":"foo"}}\z/,
182
+ times:1
183
+ end
184
+
185
+ def test_emit_text_format_as_json
186
+ config = %{
187
+ endpoint https://endpoint3.collection.us2.sumologic.com/receiver/v1/http/1234
188
+ log_format json
189
+ source_category test
190
+ source_host test
191
+ source_name test
192
+
193
+ }
194
+ driver = create_driver(config)
195
+ time = event_time
196
+ stub_request(:post, 'https://endpoint3.collection.us2.sumologic.com/receiver/v1/http/1234')
197
+ driver.run do
198
+ driver.feed("output.test", time, {'message' => 'some message'})
199
+ end
200
+ assert_requested :post, "https://endpoint3.collection.us2.sumologic.com/receiver/v1/http/1234",
201
+ headers: {'X-Sumo-Category'=>'test', 'X-Sumo-Client'=>'fluentd-output', 'X-Sumo-Host'=>'test', 'X-Sumo-Name'=>'test'},
202
+ body: /\A{"timestamp":\d+.,"message":"some message"}\z/,
203
+ times:1
204
+ end
205
+
164
206
  def test_emit_json_merge
165
207
  config = %{
166
208
  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.1.0
4
+ version: 1.1.1
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-06-29 00:00:00.000000000 Z
12
+ date: 2018-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -40,33 +40,47 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: fluentd
43
+ name: test-unit
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 3.1.0
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 3.1.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: codecov
44
58
  requirement: !ruby/object:Gem::Requirement
45
59
  requirements:
46
60
  - - ">="
47
61
  - !ruby/object:Gem::Version
48
- version: 0.14.0
49
- type: :runtime
62
+ version: 0.1.10
63
+ type: :development
50
64
  prerelease: false
51
65
  version_requirements: !ruby/object:Gem::Requirement
52
66
  requirements:
53
67
  - - ">="
54
68
  - !ruby/object:Gem::Version
55
- version: 0.14.0
69
+ version: 0.1.10
56
70
  - !ruby/object:Gem::Dependency
57
- name: test-unit
71
+ name: fluentd
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - "~>"
74
+ - - ">="
61
75
  - !ruby/object:Gem::Version
62
- version: 3.1.0
63
- type: :development
76
+ version: 0.14.0
77
+ type: :runtime
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - "~>"
81
+ - - ">="
68
82
  - !ruby/object:Gem::Version
69
- version: 3.1.0
83
+ version: 0.14.0
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: httpclient
72
86
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +104,7 @@ extensions: []
90
104
  extra_rdoc_files: []
91
105
  files:
92
106
  - ".gitignore"
107
+ - ".travis.yml"
93
108
  - CHANGELOG.md
94
109
  - Gemfile
95
110
  - LICENSE
@@ -119,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
134
  version: '0'
120
135
  requirements: []
121
136
  rubyforge_project:
122
- rubygems_version: 2.7.6
137
+ rubygems_version: 2.5.2
123
138
  signing_key:
124
139
  specification_version: 4
125
140
  summary: Output plugin to SumoLogic HTTP Endpoint