logstash-output-sumologic 1.2.0 → 1.3.2

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: 30572978a903c07948995ac86c84e13126145f6a01cd1794f47420234b4eefbd
4
- data.tar.gz: d2f9a018ec64a26634cc6a5c3b2e6631f8182982280b7f53723a0f7545ee9c6f
3
+ metadata.gz: 0cb3e69cc8d33b60f981ee807b8deeab442bca032d5715df432d467d5a917b51
4
+ data.tar.gz: 4e1c485db70cace53f2c46b7fd089be90775e74d569ace0fd1462a98ffe7fed7
5
5
  SHA512:
6
- metadata.gz: 173d6dae34af5850c7af5edac210420fa5bc7c6ccc7d9019288cf12080b5a77e3bcf111c8458acfe0a39a3fecd1fa9b76fec2716eae79883aae1d6a5879619fe
7
- data.tar.gz: 45f1e6f5a7ba96d249d7b2fdb0dd024a198b454bb3cdcdab4603e1e4430fa2cf3b9f6e56b237d6f6ae3dc7fc7545dda083a09b65662caf38c37ce18ab2cdd6a7
6
+ metadata.gz: '0478381fc42c308038c921dcede8662f5c83147f618c34bf5acf1f9c07b693d3a3e95a0978f74dc8114217b7e1c8b0aff78e29feb2435b27d6b1618a116fddb1'
7
+ data.tar.gz: f8ba1e23876443e518d468f1f2c162f4053093fa251f870b0abd61528caea9c6fdef88dd86ba91278519ee7fd5baf352479e9d97386c8e9cbcf817b19c41e2c9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.3.2 (2021-02-03)
4
+
5
+ - [#60](https://github.com/SumoLogic/logstash-output-sumologic/pull/60) Fix plugin metrics not being sent
6
+
7
+ ## 1.3.1 (2020-12-18)
8
+
9
+ - [#53](https://github.com/SumoLogic/logstash-output-sumologic/pull/53) Fix "undefined method `blank?'"
10
+ - [#52](https://github.com/SumoLogic/logstash-output-sumologic/pull/52) Fix logstash-plugin-http_client version conflict in Logstash 7
11
+
12
+ ## 1.3.0
13
+
14
+ - [#41](https://github.com/SumoLogic/logstash-output-sumologic/pull/41) Provide Docker image with Logstash 6.6 + output plugin on docker hub
15
+ - [#41](https://github.com/SumoLogic/logstash-output-sumologic/pull/41) Kubernetes support with Logstash beats to SumoLogic
16
+ - [#41](https://github.com/SumoLogic/logstash-output-sumologic/pull/41) CI improving
17
+ - [#36](https://github.com/SumoLogic/logstash-output-sumologic/pull/36) Update sender to send in batch.
18
+ - [#36](https://github.com/SumoLogic/logstash-output-sumologic/pull/36) Support %{} field evaluation in `source_category`, `source_name`, `source_host` parameters
19
+ - [#39](https://github.com/SumoLogic/logstash-output-sumologic/pull/39) Disable cookies by default
20
+
21
+ ## 1.2.2
22
+
23
+ - Bug fix: memory leak when using `%{@json}` in format
24
+
25
+ ## 1.2.1
26
+
27
+ - Bug fix on plug-in logging and samples
28
+
3
29
  ## 1.2.0
4
30
 
5
31
  - Support message piling with both `interval` and `pile_max`
@@ -13,4 +39,4 @@
13
39
 
14
40
  ## 1.0.0
15
41
 
16
- - Initial release
42
+ - Initial release
data/DEVELOPER.md CHANGED
@@ -26,8 +26,16 @@ bin/logstash-plugin install <full path of .gem>
26
26
 
27
27
  ## How to run test with rspec
28
28
 
29
- The test requires JRuby to run. So you need to install [JRuby](http://jruby.org/), [bundle](https://bundler.io/bundle_install.html) and [RVM](https://rvm.io/) (for switching between JRuby and Ruby) first.
30
- And then run:
29
+ ### Running in Docker
30
+
31
+ ```bash
32
+ docker build -t logstash-output-plugin .
33
+ docker run --rm -it -e 'sumo_url=https://events.sumologic.net/receiver/v1/http/XXXXXXXXXX' logstash-output-plugin
34
+ ```
35
+
36
+ ### Running on bare metal
37
+
38
+ The test requires JRuby to run.
31
39
 
32
40
  ```bash
33
41
  rvm use jruby
@@ -36,4 +44,12 @@ export sumo_url=https://events.sumologic.net/receiver/v1/http/XXXXXXXXXX
36
44
  rspec spec/
37
45
  ```
38
46
 
39
- The project is integrated to the Travis CI now. Make sure [all test passed](https://travis-ci.org/SumoLogic/logstash-output-sumologic) before creating PR
47
+ ## Continuous Integration
48
+
49
+ The project uses GitHub Actions for:
50
+
51
+ - Testing pull requests and main branch commits: [.github/workflows/ci.yml](.github/workflows/ci.yml)
52
+ - Publishing new version of gem to RubyGems.org after tagging: [.github/workflows/publish.yml](.github/workflows/publish.yml)
53
+
54
+ Before publishing a new version, make sure the RubyGems account has MFA disabled for API access.
55
+ Go to [Settings](https://rubygems.org/settings/edit) and set `MFA Level` to `UI only`.
data/LICENSE CHANGED
@@ -1,18 +1,196 @@
1
- Copyright (c) 2016 Sumo Logic <https://www.sumologic.com>
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
6
 
7
- http://www.apache.org/licenses/LICENSE-2.0
7
+ 1. Definitions.
8
8
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
14
11
 
15
- This product includes software developed by The Apache Software
16
- Foundation (http://www.apache.org/).
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
17
14
 
18
- This product includes software developed by Elasticsearch (http://www.elastic.co/).
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2018 Sumo Logic
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
191
+
192
+ This product includes software developed by The Apache Software
193
+ Foundation (http://www.apache.org/).
194
+
195
+ This product includes software developed by Elasticsearch
196
+ (http://www.elastic.co/).
data/README.md CHANGED
@@ -1,14 +1,10 @@
1
1
  # Logstash Sumo Logic Output Plugin
2
2
 
3
- [![Build Status](https://travis-ci.org/SumoLogic/logstash-output-sumologic.svg?branch=master)](https://travis-ci.org/SumoLogic/logstash-output-sumologic)
3
+ [![Build Status](https://travis-ci.org/SumoLogic/logstash-output-sumologic.svg?branch=master)](https://travis-ci.org/SumoLogic/logstash-output-sumologic) [![Gem Version](https://badge.fury.io/rb/logstash-output-sumologic.svg)](https://badge.fury.io/rb/logstash-output-sumologic) [![Docker Pulls](https://img.shields.io/docker/pulls/sumologic/logstash-output-sumologic.svg)](https://hub.docker.com/r/sumologic/logstash-output-sumologic)
4
4
 
5
5
  This is an output plugin for [Logstash](https://github.com/elastic/logstash).
6
6
  It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
7
7
 
8
- | TLS Deprecation Notice |
9
- | --- |
10
- | 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. |
11
-
12
8
  ## Getting Started
13
9
 
14
10
  This guide is for the users just want to download the binary and make the plugin work. For the developer, please refer to the [Developer Guide](DEVELOPER.md)
@@ -116,6 +112,7 @@ Logon to Sumo Logic [web app](https://service.sumologic.com/) and run
116
112
  | `fields_include` | array | No | all fields | Working with `fields_as_metrics` parameter, only the fields which full name matching these RegEx pattern(s) will be included in metrics.
117
113
  | `fields_exclude` | array | No | none | Working with `fields_as_metrics` parameter, the fields which full name matching these RegEx pattern(s) will be ignored in metrics.
118
114
  | `sleep_before_requeue` | number | No | `30` | The message failed to send to server will be retried after (x) seconds. Not retried if negative number set
115
+ | `stats_category` | string | No | `Logstash.stats` | The source category this plugin's stats will be sent with when `stats_enabled` is `true`
119
116
  | `stats_enabled` | boolean | No | `false` | If `true`, stats of this plugin will be sent as metrics
120
117
  | `stats_interval` | number | No | `60` | The stats will be sent every (x) seconds
121
118
 
@@ -140,7 +137,7 @@ On the other side, this version is marked as thread safe so if necessary, multip
140
137
 
141
138
  ### Monitor throughput in metrics
142
139
 
143
- If your Sumo Logic account supporting metrics feature, you can enable the stats monitor of plugin with configuring `stats_enabled` to `true`. For every `stats_interval` seconds, a batch of metrics data points will be sent to Sumo Logic with source category `XXX.stats` (`XXX` is the source category of main output). Include:
140
+ If your Sumo Logic account supports metrics feature, you can enable the stats monitor of this plugin with configuring `stats_enabled` to `true`. For every `stats_interval` seconds, a batch of metrics data points will be sent to Sumo Logic with source category specified by `stats_category` parameter:
144
141
 
145
142
  | Metric | Description |
146
143
  | ------------------------------- | ----------------------------------------------------------- |
@@ -153,3 +150,10 @@ If your Sumo Logic account supporting metrics feature, you can enable the stats
153
150
  | `total_output_bytes_compressed` | Total bytes of payloads sent to Sumo Logic server (after compressing)
154
151
  | `total_response_times` | Total number of responses acknowledged by Sumo Logic server
155
152
  | `total_response_success` | Total number of accepted(200) acknowledged by Sumo Logic server
153
+
154
+ **NOTE:** The data points will consume DPM quota
155
+
156
+
157
+ ### TLS 1.2 Requirement
158
+
159
+ Sumo Logic only accepts connections from clients using TLS version 1.2 or greater. To utilize the content of this repo, ensure that it's running in an execution environment that is configured to use TLS 1.2 or greater.
@@ -14,6 +14,7 @@ require "logstash/plugin_mixins/http_client"
14
14
  class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
15
15
  declare_threadsafe!
16
16
 
17
+ require "logstash/outputs/sumologic/batch"
17
18
  require "logstash/outputs/sumologic/common"
18
19
  require "logstash/outputs/sumologic/compressor"
19
20
  require "logstash/outputs/sumologic/header_builder"
@@ -104,19 +105,23 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
104
105
  # For messages fail to send or get 429/503/504 response, try to resend after (x) seconds; don't resend if (x) < 0
105
106
  config :sleep_before_requeue, :validate => :number, :default => 30
106
107
 
108
+ config :stats_category, :validate => :string, :default => CATEGORY_HEADER_DEFAULT_STATS
109
+
107
110
  # Sending throughput data as metrics
108
111
  config :stats_enabled, :validate => :boolean, :default => false
109
112
 
110
113
  # Sending throughput data points every (x) seconds
111
114
  config :stats_interval, :validate => :number, :default => 60
112
115
 
116
+ # Disable cookies by default (used in HTTP mixin)
117
+ config :cookies, :validate => :boolean, :default => false
118
+
113
119
  attr_reader :stats
114
120
 
115
121
  def register
116
122
  set_logger(@logger)
117
- @stats = Statistics.new()
123
+ @stats = Statistics.new
118
124
  @queue = MessageQueue.new(@stats, config)
119
- @builder = PayloadBuilder.new(@stats, config)
120
125
  @piler = Piler.new(@queue, @stats, config)
121
126
  @monitor = Monitor.new(@queue, @stats, config)
122
127
  @sender = Sender.new(client, @queue, @stats, config)
@@ -130,34 +135,18 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
130
135
  end # def register
131
136
 
132
137
  def multi_receive(events)
133
- # events.map { |e| receive(e) }
134
- begin
135
- content = Array(events).map { |event| @builder.build(event) }.join($/)
136
- @queue.enq(content)
137
- @stats.record_multi_input(events.size, content.bytesize)
138
- rescue Exception => exception
139
- log_err(
140
- "Error when processing events",
141
- :events => events,
142
- :message => exception.message,
143
- :class => exception.class.name,
144
- :backtrace => exception.backtrace
145
- )
146
- end
138
+ Array(events).map { |event| receive(event) }
147
139
  end # def multi_receive
148
140
 
149
141
  def receive(event)
150
142
  begin
151
- content = @builder.build(event)
152
- @piler.input(content)
143
+ @piler.input(event)
153
144
  rescue Exception => exception
154
- log_err(
155
- "Error when processing event",
145
+ log_err("error when processing event",
156
146
  :event => event,
157
147
  :message => exception.message,
158
148
  :class => exception.class.name,
159
- :backtrace => exception.backtrace
160
- )
149
+ :backtrace => exception.backtrace)
161
150
  end
162
151
  end # def receive
163
152
 
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ module LogStash; module Outputs; class SumoLogic;
4
+ class Batch
5
+
6
+ attr_accessor :headers, :payload
7
+
8
+ def initialize(headers, payload)
9
+ @headers, @payload = headers, payload
10
+ end
11
+
12
+ end
13
+ end; end; end;
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
- require "date"
3
-
4
2
  module LogStash; module Outputs; class SumoLogic;
5
3
  module Common
6
4
 
5
+ require "date"
6
+
7
7
  # global constants
8
8
  DEFAULT_LOG_FORMAT = "%{@timestamp} %{host} %{message}"
9
9
  METRICS_NAME_PLACEHOLDER = "*"
@@ -12,6 +12,23 @@ module LogStash; module Outputs; class SumoLogic;
12
12
  DEFLATE = "deflate"
13
13
  GZIP = "gzip"
14
14
  STATS_TAG = "STATS_TAG"
15
+ STOP_TAG = "PLUGIN STOPPED"
16
+
17
+ CONTENT_TYPE = "Content-Type"
18
+ CONTENT_TYPE_LOG = "text/plain"
19
+ CONTENT_TYPE_GRAPHITE = "application/vnd.sumologic.graphite"
20
+ CONTENT_TYPE_CARBON2 = "application/vnd.sumologic.carbon2"
21
+ CONTENT_ENCODING = "Content-Encoding"
22
+
23
+ CATEGORY_HEADER = "X-Sumo-Category"
24
+ CATEGORY_HEADER_DEFAULT = "Logstash"
25
+ CATEGORY_HEADER_DEFAULT_STATS = "Logstash.stats"
26
+ HOST_HEADER = "X-Sumo-Host"
27
+ NAME_HEADER = "X-Sumo-Name"
28
+ NAME_HEADER_DEFAULT = "logstash-output-sumologic"
29
+
30
+ CLIENT_HEADER = "X-Sumo-Client"
31
+ CLIENT_HEADER_VALUE = "logstash-output-sumologic"
15
32
 
16
33
  # for debugging test
17
34
  LOG_TO_CONSOLE = false
@@ -25,7 +42,7 @@ module LogStash; module Outputs; class SumoLogic;
25
42
  if LOG_TO_CONSOLE
26
43
  puts "[INFO:#{DateTime::now}]#{message} #{opts.to_s}"
27
44
  else
28
- @@logger && @@logger.info(message, opts)
45
+ @@logger && @@logger.info(message, *opts)
29
46
  end
30
47
  end # def log_info
31
48
 
@@ -33,7 +50,7 @@ module LogStash; module Outputs; class SumoLogic;
33
50
  if LOG_TO_CONSOLE
34
51
  puts "\e[33m[WARN:#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
35
52
  else
36
- @@logger && @@logger.warn(message, opts)
53
+ @@logger && @@logger.warn(message, *opts)
37
54
  end
38
55
  end # def log_warn
39
56
 
@@ -41,7 +58,7 @@ module LogStash; module Outputs; class SumoLogic;
41
58
  if LOG_TO_CONSOLE
42
59
  puts "\e[31m[ERR :#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
43
60
  else
44
- @@logger && @@logger.error(message, opts)
61
+ @@logger && @@logger.error(message, *opts)
45
62
  end
46
63
  end # def log_err
47
64
 
@@ -49,9 +66,19 @@ module LogStash; module Outputs; class SumoLogic;
49
66
  if LOG_TO_CONSOLE
50
67
  puts "\e[36m[DBG :#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
51
68
  else
52
- @@logger && @@logger.debug(message, opts)
69
+ @@logger && @@logger.debug(message, *opts)
53
70
  end
54
71
  end # def log_dbg
55
72
 
73
+ def blank?(value)
74
+ if value.kind_of?(NilClass)
75
+ true
76
+ elsif value.kind_of?(String)
77
+ value !~ /\S/
78
+ else
79
+ value.respond_to?(:empty?) ? value.empty? : !value
80
+ end
81
+ end
82
+
56
83
  end
57
- end; end; end
84
+ end; end; end