logstash-output-loggly 3.0.4 → 3.0.5

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: 988b81e7c80ed9063c3968da5954a960b9ecfcc224b4cce7c7bf728f0e448fae
4
- data.tar.gz: 66ba1480f37747cddf0e45c01b211338549bdc868fb2551708c52dbd539aec5c
3
+ metadata.gz: 7e0cec0e9971901b8db8203aab5425054757e7aa55419b011168fcae88917930
4
+ data.tar.gz: f0c58f28c958a39190a380e0e311b2f8267b755084f5ec72f0602b25988e0ebe
5
5
  SHA512:
6
- metadata.gz: ddcbc5937add05fca7b5ee677e91c3ec856dadb8edd4fb26af5b449601841d836bd96b5857a629822ce4cdcd878df4b31193a71125f6fce0cb02658c67c04b76
7
- data.tar.gz: c2782d76d4dbf3005faaffb7268c2c62293f21ef9d43198abae761f8be739d82359c7183ceb2c83a630b86cc5bd23414831ae533a922afd8231b8e0bda710866
6
+ metadata.gz: 9eb9897a67cbf461400c899e4674bb1cc4bb8b8230021152c3ec778c570241f466640704ffdf1d1b27c9b683c0eaf7fe8d21350aea793f7bd9283e15c40d05ff
7
+ data.tar.gz: bbb3ec8a63196e7f2091b2eb03fa16b2717a7b85a771cf742ffeac304ff8d3fca98c8cdf514f9e58c27c177f40c280d39db2f6f9db687debfdcc2715df7552ab
@@ -1,5 +1,14 @@
1
+ ## 3.0.5
2
+ - [#24](https://github.com/logstash-plugins/logstash-output-loggly/pull/24)
3
+ Get rid of a Ruby warning from using `timeout`.
4
+ - [#26](https://github.com/logstash-plugins/logstash-output-loggly/pull/26)
5
+ Docs: Better directions for getting a key in Loggly & other cleanups.
6
+ - [#26](https://github.com/logstash-plugins/logstash-output-loggly/pull/26)
7
+ Get rid of a few `puts` and reduce the noise at logging level `info`.
8
+ There is no longer 1+ log/stdout line created for every event ingested.
9
+
1
10
  ## 3.0.4
2
- - Docs: Set the default_codec doc attribute.
11
+ - Docs: Set the default\_codec doc attribute.
3
12
 
4
13
  ## 3.0.3
5
14
  - Update gemspec summary
@@ -21,7 +21,6 @@ include::{include_path}/plugin_header.asciidoc[]
21
21
 
22
22
  ==== Description
23
23
 
24
- Ugly monkey patch to get around http://jira.codehaus.org/browse/JRUBY-5529
25
24
  Got a loggly account? Use logstash to ship logs to Loggly!
26
25
 
27
26
  This is most useful so you can use logstash to parse and structure
@@ -82,13 +81,9 @@ https://www.loggly.com/docs/http-endpoint/
82
81
  * Value type is <<string,string>>
83
82
  * There is no default value for this setting.
84
83
 
85
- The loggly http input key to send to.
86
- This is usually visible in the Loggly 'Inputs' page as something like this:
87
- ....
88
- https://logs-01.loggly.net/inputs/abcdef12-3456-7890-abcd-ef0123456789
89
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90
- \----------> key <-------------/
91
- ....
84
+ The loggly http customer token to use for sending.
85
+ You can find yours in "Source Setup", under "Customer Tokens".
86
+
92
87
  You can use `%{foo}` field lookups here if you need to pull the api key from
93
88
  the event. This is mainly aimed at multitenant hosting providers who want
94
89
  to offer shipping a customer's logs to that customer's loggly account.
@@ -164,4 +159,4 @@ https://www.loggly.com/docs/source-groups/
164
159
  [id="plugins-{type}s-{plugin}-common-options"]
165
160
  include::{include_path}/{type}.asciidoc[]
166
161
 
167
- :default_codec!:
162
+ :default_codec!:
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/outputs/base"
3
3
  require "logstash/namespace"
4
+ require "timeout"
4
5
  require "uri"
5
6
  # TODO(sissel): Move to something that performs better than net/http
6
7
  require "net/http"
@@ -12,7 +13,7 @@ Net::BufferedIO.class_eval do
12
13
  BUFSIZE = 1024 * 16
13
14
 
14
15
  def rbuf_fill
15
- timeout(@read_timeout) {
16
+ ::Timeout.timeout(@read_timeout) {
16
17
  @rbuf << @io.sysread(BUFSIZE)
17
18
  }
18
19
  end
@@ -34,13 +35,9 @@ class LogStash::Outputs::Loggly < LogStash::Outputs::Base
34
35
  # https://www.loggly.com/docs/http-endpoint/
35
36
  config :host, :validate => :string, :default => "logs-01.loggly.com"
36
37
 
37
- # The loggly http input key to send to.
38
- # This is usually visible in the Loggly 'Inputs' page as something like this:
39
- # ....
40
- # https://logs-01.loggly.net/inputs/abcdef12-3456-7890-abcd-ef0123456789
41
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42
- # \----------> key <-------------/
43
- # ....
38
+ # The loggly http customer token to use for sending.
39
+ # You can find yours in "Source Setup", under "Customer Tokens".
40
+ #
44
41
  # You can use `%{foo}` field lookups here if you need to pull the api key from
45
42
  # the event. This is mainly aimed at multitenant hosting providers who want
46
43
  # to offer shipping a customer's logs to that customer's loggly account.
@@ -115,7 +112,7 @@ class LogStash::Outputs::Loggly < LogStash::Outputs::Base
115
112
  private
116
113
  def send_event(url, message)
117
114
  url = URI.parse(url)
118
- @logger.info("Loggly URL", :url => url)
115
+ @logger.debug("Loggly URL", :url => url)
119
116
 
120
117
  http = Net::HTTP::Proxy(@proxy_host,
121
118
  @proxy_port,
@@ -127,7 +124,7 @@ class LogStash::Outputs::Loggly < LogStash::Outputs::Base
127
124
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
128
125
  end
129
126
 
130
- request = Net::HTTP::Post.new(url.path)
127
+ request = Net::HTTP::Post.new(url.path, {'Content-Type' =>'application/json'})
131
128
  request.body = message
132
129
 
133
130
  # Variable for count total retries
@@ -138,47 +135,47 @@ class LogStash::Outputs::Loggly < LogStash::Outputs::Base
138
135
  @retry_count = 1
139
136
  end
140
137
 
141
-
138
+
142
139
  @retry_count.times do
143
- begin
144
- response = http.request(request)
145
- case response.code
146
-
147
- # HTTP_SUCCESS :Code 2xx
148
- when HTTP_SUCCESS
149
- puts "Event send to Loggly"
150
-
151
- # HTTP_FORBIDDEN :Code 403
152
- when HTTP_FORBIDDEN
153
- @logger.warn("User does not have privileges to execute the action.")
154
-
155
- # HTTP_NOT_FOUND :Code 404
156
- when HTTP_NOT_FOUND
157
- @logger.warn("Invalid URL. Please check URL should be http://logs-01.loggly.com/inputs/CUSTOMER_TOKEN/tag/logstash")
158
-
159
- # HTTP_INTERNAL_SERVER_ERROR :Code 500
160
- when HTTP_INTERNAL_SERVER_ERROR
161
- @logger.warn("Internal Server Error")
162
-
163
- # HTTP_GATEWAY_TIMEOUT :Code 504
164
- when HTTP_GATEWAY_TIMEOUT
165
- @logger.warn("Gateway Time Out")
166
- else
167
- @logger.error("Unexpected response code", :code => response.code)
168
- end # case
169
-
170
- if [HTTP_SUCCESS,HTTP_FORBIDDEN,HTTP_NOT_FOUND].include?(response.code) # break the retries loop for the specified response code
171
- break
172
- end
173
- rescue StandardError => e
140
+ begin
141
+ response = http.request(request)
142
+ case response.code
143
+
144
+ # HTTP_SUCCESS :Code 2xx
145
+ when HTTP_SUCCESS
146
+ @logger.debug("Event sent to Loggly")
147
+
148
+ # HTTP_FORBIDDEN :Code 403
149
+ when HTTP_FORBIDDEN
150
+ @logger.warn("User does not have privileges to execute the action.")
151
+
152
+ # HTTP_NOT_FOUND :Code 404
153
+ when HTTP_NOT_FOUND
154
+ @logger.warn("Invalid URL. Please check URL should be http://logs-01.loggly.com/inputs/CUSTOMER_TOKEN/tag/logstash")
155
+
156
+ # HTTP_INTERNAL_SERVER_ERROR :Code 500
157
+ when HTTP_INTERNAL_SERVER_ERROR
158
+ @logger.warn("Internal Server Error")
159
+
160
+ # HTTP_GATEWAY_TIMEOUT :Code 504
161
+ when HTTP_GATEWAY_TIMEOUT
162
+ @logger.warn("Gateway Time Out")
163
+ else
164
+ @logger.error("Unexpected response code", :code => response.code)
165
+ end # case
166
+
167
+ if [HTTP_SUCCESS,HTTP_FORBIDDEN,HTTP_NOT_FOUND].include?(response.code) # break the retries loop for the specified response code
168
+ break
169
+ end
170
+ rescue StandardError => e
174
171
  @logger.error("An unexpected error occurred", :exception => e.class.name, :error => e.to_s, :backtrace => e.backtrace)
175
172
  end # rescue
176
-
173
+
177
174
  if totalRetries < @retry_count && totalRetries > 0
178
- puts "Waiting for five seconds before retry..."
175
+ @logger.warn "Waiting for five seconds before retry..."
179
176
  sleep(5)
180
177
  end
181
-
178
+
182
179
  totalRetries = totalRetries + 1
183
180
  end #loop
184
181
  end # def send_event
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-loggly'
3
- s.version = '3.0.4'
3
+ s.version = '3.0.5'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Ships logs to Loggly"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-loggly
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-06 00:00:00.000000000 Z
11
+ date: 2018-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.6.11
101
+ rubygems_version: 2.6.13
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Ships logs to Loggly