logstash-output-sumologic 1.1.3 → 1.1.4

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: b6d9bc4c2957d756a60ef1aeab7f037e7ce17b4a
4
- data.tar.gz: 9e2fee37103045a75c2a9d1d226ccfd7a6b34377
3
+ metadata.gz: 2e93fc2c3b965317a3ce2e7d4dac9400bb9ef83f
4
+ data.tar.gz: 63e2f08e478e46ee1e9413f983dfd3c4973aa183
5
5
  SHA512:
6
- metadata.gz: 3f98566dfe28f2df44735658f0f92670498b956e707b82213b5b750f12c014e6ad92b466d6f38edba1c6ceec9034d68f1c2c3b3875041093daace936854a0f84
7
- data.tar.gz: a6b18a26bdf395dc9d6ac87fba8da40cedf4a0d0aad38d3046a590089225e44359c86179469cdcd321ef79f6c00ef40ed8c2c004d2d50b8e1a8ad5719d788a6b
6
+ metadata.gz: d65bf23542a63ce80fe6d129bdf33d96d03b046461b344773575d9a672a8880f0f3f490a79aee8fe1d2b527ff143c39808bf0c8b05aacbcfb6e4705183cc2a2e
7
+ data.tar.gz: cc696890c823265d3f0b21a4cf6daf2d24dadf841f5401a80c36e0ebad6fac263582f9bafd2f4d8e628f57ec9273508bc52b2c56e4d64b44700ad33fbf69d3a5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.1.4
2
+ - bug fix
3
+
4
+ ## 1.1.3
5
+ - bug fix
6
+
1
7
  ## 1.1.0
2
8
  - Support metrics sending
3
9
 
@@ -121,14 +121,22 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
121
121
 
122
122
  public
123
123
  def receive(event)
124
- if event == LogStash::SHUTDOWN
125
- finished
126
- return
127
- end
124
+ begin
125
+
126
+ if event == LogStash::SHUTDOWN
127
+ finished
128
+ return
129
+ end
128
130
 
129
- content = event2content(event)
130
- queue_and_send(content)
131
-
131
+ content = event2content(event)
132
+ queue_and_send(content)
133
+
134
+ rescue
135
+ log_failure(
136
+ "Error when processing event",
137
+ :event => event
138
+ )
139
+ end
132
140
  end # def receive
133
141
 
134
142
  public
@@ -333,7 +341,9 @@ end # def dotify
333
341
 
334
342
  private
335
343
  def expand(template, event)
336
- template = template.gsub("%{@json}", LogStash::Json.dump(event2hash(event))) if template.include? "%{@json}"
344
+ hash = event2hash(event)
345
+ dump = LogStash::Json.dump(hash)
346
+ template = template.gsub("%{@json}") { dump }
337
347
  event.sprintf(template)
338
348
  end # def expand
339
349
 
@@ -373,7 +383,7 @@ end # def dotify
373
383
 
374
384
  private
375
385
  def get_metrics_name(event, name)
376
- name = @metrics_name.gsub(METRICS_NAME_PLACEHOLDER, name) if @metrics_name
386
+ name = @metrics_name.gsub(METRICS_NAME_PLACEHOLDER) { name } if @metrics_name
377
387
  event.sprintf(name)
378
388
  end # def get_metrics_name
379
389
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "logstash-output-sumologic"
3
- s.version = "1.1.3"
3
+ s.version = "1.1.4"
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,6 @@ 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_runtime_dependency 'logstash-mixin-http_client', ">= 6.0.0", "< 7.0.0"
23
24
  s.add_development_dependency "logstash-devutils", "~> 1.3", ">= 1.3.1"
24
25
  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.3
4
+ version: 1.1.4
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-03-13 00:00:00.000000000 Z
11
+ date: 2018-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,26 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 6.0.0
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: 7.0.0
50
+ name: logstash-mixin-http_client
51
+ prerelease: false
52
+ type: :runtime
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 6.0.0
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: 7.0.0
41
61
  - !ruby/object:Gem::Dependency
42
62
  requirement: !ruby/object:Gem::Requirement
43
63
  requirements:
@@ -73,7 +93,6 @@ files:
73
93
  - LICENSE
74
94
  - README.md
75
95
  - lib/logstash/outputs/sumologic.rb
76
- - lib/logstash/plugin_mixins/http_client.rb
77
96
  - logstash-output-sumologic.gemspec
78
97
  - spec/outputs/sumologic_spec.rb
79
98
  - spec/spec_helper.rb
@@ -1,187 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/config/mixin"
3
-
4
- # This module makes it easy to add a very fully configured HTTP client to logstash
5
- # based on [Manticore](https://github.com/cheald/manticore).
6
- # For an example of its usage see https://github.com/logstash-plugins/logstash-input-http_poller
7
- module LogStash::PluginMixins::HttpClient
8
- class InvalidHTTPConfigError < StandardError; end
9
-
10
- def self.included(base)
11
- require 'manticore'
12
- base.extend(self)
13
- base.setup_http_client_config
14
- end
15
-
16
- public
17
- def setup_http_client_config
18
- # Timeout (in seconds) for the entire request
19
- config :request_timeout, :validate => :number, :default => 60
20
-
21
- # Timeout (in seconds) to wait for data on the socket. Default is `10s`
22
- config :socket_timeout, :validate => :number, :default => 10
23
-
24
- # Timeout (in seconds) to wait for a connection to be established. Default is `10s`
25
- config :connect_timeout, :validate => :number, :default => 10
26
-
27
- # Should redirects be followed? Defaults to `true`
28
- config :follow_redirects, :validate => :boolean, :default => true
29
-
30
- # Max number of concurrent connections. Defaults to `50`
31
- config :pool_max, :validate => :number, :default => 50
32
-
33
- # Max number of concurrent connections to a single host. Defaults to `25`
34
- config :pool_max_per_route, :validate => :number, :default => 25
35
-
36
- # Turn this on to enable HTTP keepalive support. We highly recommend setting `automatic_retries` to at least
37
- # one with this to fix interactions with broken keepalive implementations.
38
- config :keepalive, :validate => :boolean, :default => true
39
-
40
- # How many times should the client retry a failing URL. We highly recommend NOT setting this value
41
- # to zero if keepalive is enabled. Some servers incorrectly end keepalives early requiring a retry!
42
- # Note: if `retry_non_idempotent` is set only GET, HEAD, PUT, DELETE, OPTIONS, and TRACE requests will be retried.
43
- config :automatic_retries, :validate => :number, :default => 1
44
-
45
- # If `automatic_retries` is enabled this will cause non-idempotent HTTP verbs (such as POST) to be retried.
46
- config :retry_non_idempotent, :validate => :boolean, :default => false
47
-
48
- # How long to wait before checking if the connection is stale before executing a request on a connection using keepalive.
49
- # # You may want to set this lower, possibly to 0 if you get connection errors regularly
50
- # Quoting the Apache commons docs (this client is based Apache Commmons):
51
- # 'Defines period of inactivity in milliseconds after which persistent connections must be re-validated prior to being leased to the consumer. Non-positive value passed to this method disables connection validation. This check helps detect connections that have become stale (half-closed) while kept inactive in the pool.'
52
- # See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info]
53
- config :validate_after_inactivity, :validate => :number, :default => 200
54
-
55
- config :ssl_certificate_validation, :deprecated => "This never worked correctly and is now deprecated and a noop"
56
-
57
- # If you need to use a custom X.509 CA (.pem certs) specify the path to that here
58
- config :cacert, :validate => :path
59
-
60
- # If you'd like to use a client certificate (note, most people don't want this) set the path to the x509 cert here
61
- config :client_cert, :validate => :path
62
- # If you're using a client certificate specify the path to the encryption key here
63
- config :client_key, :validate => :path
64
-
65
- # If you need to use a custom keystore (`.jks`) specify that here. This does not work with .pem keys!
66
- config :keystore, :validate => :path
67
-
68
- # Specify the keystore password here.
69
- # Note, most .jks files created with keytool require a password!
70
- config :keystore_password, :validate => :password
71
-
72
- # Specify the keystore type here. One of `JKS` or `PKCS12`. Default is `JKS`
73
- config :keystore_type, :validate => :string, :default => "JKS"
74
-
75
- # If you need to use a custom truststore (`.jks`) specify that here. This does not work with .pem certs!
76
- config :truststore, :validate => :path
77
-
78
- # Specify the truststore password here.
79
- # Note, most .jks files created with keytool require a password!
80
- config :truststore_password, :validate => :password
81
-
82
- # Specify the truststore type here. One of `JKS` or `PKCS12`. Default is `JKS`
83
- config :truststore_type, :validate => :string, :default => "JKS"
84
-
85
- # Enable cookie support. With this enabled the client will persist cookies
86
- # across requests as a normal web browser would. Enabled by default
87
- config :cookies, :validate => :boolean, :default => true
88
-
89
- # If you'd like to use an HTTP proxy . This supports multiple configuration syntaxes:
90
- #
91
- # 1. Proxy host in form: `http://proxy.org:1234`
92
- # 2. Proxy host in form: `{host => "proxy.org", port => 80, scheme => 'http', user => 'username@host', password => 'password'}`
93
- # 3. Proxy host in form: `{url => 'http://proxy.org:1234', user => 'username@host', password => 'password'}`
94
- config :proxy
95
-
96
- # Username to use for HTTP auth.
97
- config :user, :validate => :string
98
-
99
- # Password to use for HTTP auth
100
- config :password, :validate => :password
101
- end
102
-
103
- public
104
- def client_config
105
- c = {
106
- connect_timeout: @connect_timeout,
107
- socket_timeout: @socket_timeout,
108
- request_timeout: @request_timeout,
109
- follow_redirects: @follow_redirects,
110
- automatic_retries: @automatic_retries,
111
- retry_non_idempotent: @retry_non_idempotent,
112
- check_connection_timeout: @validate_after_inactivity,
113
- pool_max: @pool_max,
114
- pool_max_per_route: @pool_max_per_route,
115
- cookies: @cookies,
116
- keepalive: @keepalive
117
- }
118
-
119
- if @proxy
120
- # Symbolize keys if necessary
121
- c[:proxy] = @proxy.is_a?(Hash) ?
122
- @proxy.reduce({}) {|memo,(k,v)| memo[k.to_sym] = v; memo} :
123
- @proxy
124
- end
125
-
126
- if @user
127
- if !@password || !@password.value
128
- raise ::LogStash::ConfigurationError, "User '#{@user}' specified without password!"
129
- end
130
-
131
- # Symbolize keys if necessary
132
- c[:auth] = {
133
- :user => @user,
134
- :password => @password.value,
135
- :eager => true
136
- }
137
- end
138
-
139
- c[:ssl] = {}
140
- if @cacert
141
- c[:ssl][:ca_file] = @cacert
142
- end
143
-
144
- if @truststore
145
- c[:ssl].merge!(
146
- :truststore => @truststore,
147
- :truststore_type => @truststore_type,
148
- :truststore_password => @truststore_password.value
149
- )
150
-
151
- if c[:ssl][:truststore_password].nil?
152
- raise LogStash::ConfigurationError, "Truststore declared without a password! This is not valid, please set the 'truststore_password' option"
153
- end
154
- end
155
-
156
- if @keystore
157
- c[:ssl].merge!(
158
- :keystore => @keystore,
159
- :keystore_type => @keystore_type,
160
- :keystore_password => @keystore_password.value
161
- )
162
-
163
- if c[:ssl][:keystore_password].nil?
164
- raise LogStash::ConfigurationError, "Keystore declared without a password! This is not valid, please set the 'keystore_password' option"
165
- end
166
- end
167
-
168
- if @client_cert && @client_key
169
- c[:ssl][:client_cert] = @client_cert
170
- c[:ssl][:client_key] = @client_key
171
- elsif !!@client_cert ^ !!@client_key
172
- raise InvalidHTTPConfigError, "You must specify both client_cert and client_key for an HTTP client, or neither!"
173
- end
174
-
175
- c
176
- end
177
-
178
- private
179
- def make_client
180
- Manticore::Client.new(client_config)
181
- end
182
-
183
- public
184
- def client
185
- @client ||= make_client
186
- end
187
- end