logstash-output-loggly 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/docs/index.asciidoc +4 -9
- data/lib/logstash/outputs/loggly.rb +42 -45
- data/logstash-output-loggly.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e0cec0e9971901b8db8203aab5425054757e7aa55419b011168fcae88917930
|
4
|
+
data.tar.gz: f0c58f28c958a39190a380e0e311b2f8267b755084f5ec72f0602b25988e0ebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eb9897a67cbf461400c899e4674bb1cc4bb8b8230021152c3ec778c570241f466640704ffdf1d1b27c9b683c0eaf7fe8d21350aea793f7bd9283e15c40d05ff
|
7
|
+
data.tar.gz: bbb3ec8a63196e7f2091b2eb03fa16b2717a7b85a771cf742ffeac304ff8d3fca98c8cdf514f9e58c27c177f40c280d39db2f6f9db687debfdcc2715df7552ab
|
data/CHANGELOG.md
CHANGED
@@ -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
|
11
|
+
- Docs: Set the default\_codec doc attribute.
|
3
12
|
|
4
13
|
## 3.0.3
|
5
14
|
- Update gemspec summary
|
data/docs/index.asciidoc
CHANGED
@@ -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
|
86
|
-
|
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
|
38
|
-
#
|
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.
|
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
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
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
|
-
|
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.
|
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
|
+
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-
|
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.
|
101
|
+
rubygems_version: 2.6.13
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Ships logs to Loggly
|