logstash-output-sumologic 1.2.0 → 1.2.1
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 +4 -0
- data/LICENSE +191 -13
- data/README.md +4 -2
- data/lib/logstash/outputs/sumologic/common.rb +4 -4
- data/lib/logstash/outputs/sumologic/message_queue.rb +14 -3
- data/lib/logstash/outputs/sumologic/monitor.rb +7 -3
- data/lib/logstash/outputs/sumologic/piler.rb +8 -4
- data/lib/logstash/outputs/sumologic/sender.rb +33 -32
- data/lib/logstash/outputs/sumologic.rb +4 -8
- data/logstash-output-sumologic.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: bac8ea0f42696fc64e13aac561ca08a18adce05b424b201e5c55c11e7e7432a4
|
4
|
+
data.tar.gz: f5d3fd83235d5055d6753757bdd2e691e4de374179b2ef1925e8a2e704120f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e1b55bfb6262583b96e633b3551c51f2ff911f53d1209fae5f91f969a3685c64776af459a08dae6a019c54a5a99b076e36ea1b37658770ced7af4cc90e5e5b4
|
7
|
+
data.tar.gz: 3671fd5fdc158f55ae0b7d7a84ca923c3454429c35c0540c2f5f349bb4120c78297aeb2dfdba61638b087f76b9f2be6eb9ca902f7c2617886326d5afaf3af8e2
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -1,18 +1,196 @@
|
|
1
|
-
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
2
4
|
|
3
|
-
|
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
|
-
|
7
|
+
1. Definitions.
|
8
8
|
|
9
|
-
|
10
|
-
|
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
|
-
|
16
|
-
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
17
14
|
|
18
|
-
|
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,6 +1,6 @@
|
|
1
1
|
# Logstash Sumo Logic Output Plugin
|
2
2
|
|
3
|
-
[](https://travis-ci.org/SumoLogic/logstash-output-sumologic)
|
3
|
+
[](https://travis-ci.org/SumoLogic/logstash-output-sumologic) [](https://badge.fury.io/rb/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.
|
@@ -140,7 +140,7 @@ On the other side, this version is marked as thread safe so if necessary, multip
|
|
140
140
|
|
141
141
|
### Monitor throughput in metrics
|
142
142
|
|
143
|
-
If your Sumo Logic account
|
143
|
+
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 `XXX.stats` (`XXX` is the source category of main output):
|
144
144
|
|
145
145
|
| Metric | Description |
|
146
146
|
| ------------------------------- | ----------------------------------------------------------- |
|
@@ -153,3 +153,5 @@ If your Sumo Logic account supporting metrics feature, you can enable the stats
|
|
153
153
|
| `total_output_bytes_compressed` | Total bytes of payloads sent to Sumo Logic server (after compressing)
|
154
154
|
| `total_response_times` | Total number of responses acknowledged by Sumo Logic server
|
155
155
|
| `total_response_success` | Total number of accepted(200) acknowledged by Sumo Logic server
|
156
|
+
|
157
|
+
**NOTE:** The data points will consume DPM quota
|
@@ -25,7 +25,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
25
25
|
if LOG_TO_CONSOLE
|
26
26
|
puts "[INFO:#{DateTime::now}]#{message} #{opts.to_s}"
|
27
27
|
else
|
28
|
-
@@logger && @@logger.info(message, opts)
|
28
|
+
@@logger && @@logger.info(message, *opts)
|
29
29
|
end
|
30
30
|
end # def log_info
|
31
31
|
|
@@ -33,7 +33,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
33
33
|
if LOG_TO_CONSOLE
|
34
34
|
puts "\e[33m[WARN:#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
|
35
35
|
else
|
36
|
-
@@logger && @@logger.warn(message, opts)
|
36
|
+
@@logger && @@logger.warn(message, *opts)
|
37
37
|
end
|
38
38
|
end # def log_warn
|
39
39
|
|
@@ -41,7 +41,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
41
41
|
if LOG_TO_CONSOLE
|
42
42
|
puts "\e[31m[ERR :#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
|
43
43
|
else
|
44
|
-
@@logger && @@logger.error(message, opts)
|
44
|
+
@@logger && @@logger.error(message, *opts)
|
45
45
|
end
|
46
46
|
end # def log_err
|
47
47
|
|
@@ -49,7 +49,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
49
49
|
if LOG_TO_CONSOLE
|
50
50
|
puts "\e[36m[DBG :#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
|
51
51
|
else
|
52
|
-
@@logger && @@logger.debug(message, opts)
|
52
|
+
@@logger && @@logger.debug(message, *opts)
|
53
53
|
end
|
54
54
|
end # def log_dbg
|
55
55
|
|
@@ -5,24 +5,35 @@ require "logstash/outputs/sumologic/statistics"
|
|
5
5
|
module LogStash; module Outputs; class SumoLogic;
|
6
6
|
class MessageQueue
|
7
7
|
|
8
|
+
include LogStash::Outputs::SumoLogic::Common
|
9
|
+
|
8
10
|
def initialize(stats, config)
|
9
11
|
@queue_max = (config["queue_max"] ||= 1) < 1 ? 1 : config["queue_max"]
|
10
12
|
@queue = SizedQueue::new(@queue_max)
|
13
|
+
log_info("initialize memory queue", :max => @queue_max)
|
11
14
|
@stats = stats
|
12
|
-
end
|
15
|
+
end # def initialize
|
13
16
|
|
14
17
|
def enq(obj)
|
15
18
|
if (obj.bytesize > 0)
|
16
19
|
@queue.enq(obj)
|
17
20
|
@stats.record_enque(obj)
|
21
|
+
log_dbg("enqueue",
|
22
|
+
:objects_in_queue => size,
|
23
|
+
:bytes_in_queue => @stats.current_queue_bytes,
|
24
|
+
:size => obj.bytesize)
|
18
25
|
end
|
19
|
-
end # def
|
26
|
+
end # def enq
|
20
27
|
|
21
28
|
def deq()
|
22
29
|
obj = @queue.deq()
|
23
30
|
@stats.record_deque(obj)
|
31
|
+
log_dbg("dequeue",
|
32
|
+
:objects_in_queue => size,
|
33
|
+
:bytes_in_queue => @stats.current_queue_bytes,
|
34
|
+
:size => obj.bytesize)
|
24
35
|
obj
|
25
|
-
end # def
|
36
|
+
end # def deq
|
26
37
|
|
27
38
|
def drain()
|
28
39
|
@queue.size.times.map {
|
@@ -21,6 +21,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
21
21
|
end # initialize
|
22
22
|
|
23
23
|
def start()
|
24
|
+
log_info("starting monitor...", :interval => @interval)
|
24
25
|
@stopping.make_false()
|
25
26
|
if (@enabled)
|
26
27
|
@monitor_t = Thread.new {
|
@@ -37,9 +38,9 @@ module LogStash; module Outputs; class SumoLogic;
|
|
37
38
|
def stop()
|
38
39
|
@stopping.make_true()
|
39
40
|
if (@enabled)
|
40
|
-
log_info
|
41
|
+
log_info("shutting down monitor...")
|
41
42
|
@monitor_t.join
|
42
|
-
log_info
|
43
|
+
log_info("monitor is fully shutted down")
|
43
44
|
end
|
44
45
|
end # def stop
|
45
46
|
|
@@ -58,9 +59,12 @@ module LogStash; module Outputs; class SumoLogic;
|
|
58
59
|
"total_response_success"
|
59
60
|
].map { |key|
|
60
61
|
value = @stats.send(key).value
|
62
|
+
log_dbg("stats",
|
63
|
+
:key => key,
|
64
|
+
:value => value)
|
61
65
|
build_metric_line(key, value, timestamp)
|
62
66
|
}.join($/)
|
63
|
-
|
67
|
+
|
64
68
|
"#{STATS_TAG}#{counters}"
|
65
69
|
end # def build_stats_payload
|
66
70
|
|
@@ -30,10 +30,13 @@ module LogStash; module Outputs; class SumoLogic;
|
|
30
30
|
def start()
|
31
31
|
@stopping.make_false()
|
32
32
|
if (@is_pile)
|
33
|
+
log_info("starting piler...",
|
34
|
+
:max => @pile_max,
|
35
|
+
:timeout => @interval)
|
33
36
|
@piler_t = Thread.new {
|
34
37
|
while @stopping.false?
|
35
38
|
Stud.stoppable_sleep(@interval) { @stopping.true? }
|
36
|
-
log_dbg("timeout,
|
39
|
+
log_dbg("timeout", :timeout => @interval)
|
37
40
|
enq_and_clear()
|
38
41
|
end # while
|
39
42
|
}
|
@@ -43,15 +46,16 @@ module LogStash; module Outputs; class SumoLogic;
|
|
43
46
|
def stop()
|
44
47
|
@stopping.make_true()
|
45
48
|
if (@is_pile)
|
46
|
-
log_info
|
49
|
+
log_info("shutting down piler...")
|
47
50
|
@piler_t.join
|
48
|
-
log_info
|
51
|
+
log_info("piler is fully shutted down")
|
49
52
|
end
|
50
53
|
end # def stop
|
51
54
|
|
52
55
|
def input(entry)
|
53
56
|
if (@stopping.true?)
|
54
|
-
log_warn
|
57
|
+
log_warn("piler is shutting down, message dropped",
|
58
|
+
"message" => entry)
|
55
59
|
elsif (@is_pile)
|
56
60
|
@semaphore.synchronize {
|
57
61
|
if @pile_size + entry.bytesize > @pile_max
|
@@ -36,6 +36,9 @@ module LogStash; module Outputs; class SumoLogic;
|
|
36
36
|
end # def initialize
|
37
37
|
|
38
38
|
def start()
|
39
|
+
log_info("starting sender...",
|
40
|
+
:max => @sender_max,
|
41
|
+
:requeue => @sleep_before_requeue)
|
39
42
|
@stopping.make_false()
|
40
43
|
@sender_t = Thread.new {
|
41
44
|
while @stopping.false?
|
@@ -45,20 +48,20 @@ module LogStash; module Outputs; class SumoLogic;
|
|
45
48
|
@queue.drain().map { |content|
|
46
49
|
send_request(content)
|
47
50
|
}
|
48
|
-
log_info
|
51
|
+
log_info("waiting while senders finishing...")
|
49
52
|
while @tokens.size < @sender_max
|
50
53
|
sleep 1
|
51
54
|
end # while
|
52
55
|
}
|
53
|
-
end # def
|
56
|
+
end # def start
|
54
57
|
|
55
58
|
def stop()
|
56
|
-
log_info
|
59
|
+
log_info("shutting down sender...")
|
57
60
|
@stopping.make_true()
|
58
61
|
@queue.enq(STOP_TAG)
|
59
62
|
@sender_t.join
|
60
|
-
log_info
|
61
|
-
end # def
|
63
|
+
log_info("sender is fully shutted down")
|
64
|
+
end # def stop
|
62
65
|
|
63
66
|
def connect()
|
64
67
|
uri = URI.parse(@url)
|
@@ -68,25 +71,22 @@ module LogStash; module Outputs; class SumoLogic;
|
|
68
71
|
begin
|
69
72
|
res = http.request(request)
|
70
73
|
if res.code.to_i != 200
|
71
|
-
log_err(
|
72
|
-
"Server rejected the request",
|
74
|
+
log_err("ping rejected",
|
73
75
|
:url => @url,
|
74
|
-
:code => res.code
|
75
|
-
|
76
|
+
:code => res.code,
|
77
|
+
:body => res.body)
|
76
78
|
false
|
77
79
|
else
|
78
|
-
|
79
|
-
|
80
|
-
:url => @url
|
81
|
-
)
|
80
|
+
log_info("ping accepted",
|
81
|
+
:url => @url)
|
82
82
|
true
|
83
83
|
end
|
84
|
-
rescue Exception =>
|
85
|
-
log_err(
|
86
|
-
"Cannot connect to given url",
|
84
|
+
rescue Exception => exception
|
85
|
+
log_err("ping failed",
|
87
86
|
:url => @url,
|
88
|
-
:
|
89
|
-
|
87
|
+
:message => exception.message,
|
88
|
+
:class => exception.class.name,
|
89
|
+
:backtrace => exception.backtrace)
|
90
90
|
false
|
91
91
|
end
|
92
92
|
end # def connect
|
@@ -95,7 +95,7 @@ module LogStash; module Outputs; class SumoLogic;
|
|
95
95
|
|
96
96
|
def send_request(content)
|
97
97
|
if content == STOP_TAG
|
98
|
-
|
98
|
+
log_info("STOP_TAG is received.")
|
99
99
|
return
|
100
100
|
end
|
101
101
|
|
@@ -108,7 +108,12 @@ module LogStash; module Outputs; class SumoLogic;
|
|
108
108
|
body = @compressor.compress(content)
|
109
109
|
headers = @headers
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
|
+
log_dbg("sending request",
|
113
|
+
:headers => headers,
|
114
|
+
:content_size => content.size,
|
115
|
+
:content => content[0..20],
|
116
|
+
:payload_size => body.size)
|
112
117
|
request = @client.send(:background).send(:post, @url, :body => body, :headers => headers)
|
113
118
|
|
114
119
|
request.on_complete do
|
@@ -118,19 +123,16 @@ module LogStash; module Outputs; class SumoLogic;
|
|
118
123
|
request.on_success do |response|
|
119
124
|
@stats.record_response_success(response.code)
|
120
125
|
if response.code < 200 || response.code > 299
|
121
|
-
log_err(
|
122
|
-
"HTTP request rejected(#{response.code})",
|
126
|
+
log_err("request rejected",
|
123
127
|
:token => token,
|
124
128
|
:code => response.code,
|
125
129
|
:headers => headers,
|
126
|
-
:contet => content[0..20]
|
127
|
-
)
|
130
|
+
:contet => content[0..20])
|
128
131
|
if response.code == 429 || response.code == 503 || response.code == 504
|
129
132
|
requeue_message(content)
|
130
133
|
end
|
131
134
|
else
|
132
|
-
log_dbg(
|
133
|
-
"HTTP request accepted",
|
135
|
+
log_dbg("request accepted",
|
134
136
|
:token => token,
|
135
137
|
:code => response.code)
|
136
138
|
end
|
@@ -138,13 +140,11 @@ module LogStash; module Outputs; class SumoLogic;
|
|
138
140
|
|
139
141
|
request.on_failure do |exception|
|
140
142
|
@stats.record_response_failure()
|
141
|
-
log_err(
|
142
|
-
"Error in network transmission",
|
143
|
+
log_err("error in network transmission",
|
143
144
|
:token => token,
|
144
145
|
:message => exception.message,
|
145
146
|
:class => exception.class.name,
|
146
|
-
:backtrace => exception.backtrace
|
147
|
-
)
|
147
|
+
:backtrace => exception.backtrace)
|
148
148
|
requeue_message(content)
|
149
149
|
end
|
150
150
|
|
@@ -154,9 +154,10 @@ module LogStash; module Outputs; class SumoLogic;
|
|
154
154
|
|
155
155
|
def requeue_message(content)
|
156
156
|
if @stopping.false? && @sleep_before_requeue >= 0
|
157
|
-
|
158
|
-
"requeue message",
|
157
|
+
log_info("requeue message",
|
159
158
|
:after => @sleep_before_requeue,
|
159
|
+
:queue_size => @queue.size,
|
160
|
+
:content_size => content.size,
|
160
161
|
:content => content[0..20])
|
161
162
|
Stud.stoppable_sleep(@sleep_before_requeue) { @stopping.true? }
|
162
163
|
@queue.enq(content)
|
@@ -136,13 +136,11 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
|
|
136
136
|
@queue.enq(content)
|
137
137
|
@stats.record_multi_input(events.size, content.bytesize)
|
138
138
|
rescue Exception => exception
|
139
|
-
log_err(
|
140
|
-
"Error when processing events",
|
139
|
+
log_err("error when processing events",
|
141
140
|
:events => events,
|
142
141
|
:message => exception.message,
|
143
142
|
:class => exception.class.name,
|
144
|
-
:backtrace => exception.backtrace
|
145
|
-
)
|
143
|
+
:backtrace => exception.backtrace)
|
146
144
|
end
|
147
145
|
end # def multi_receive
|
148
146
|
|
@@ -151,13 +149,11 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
|
|
151
149
|
content = @builder.build(event)
|
152
150
|
@piler.input(content)
|
153
151
|
rescue Exception => exception
|
154
|
-
log_err(
|
155
|
-
"Error when processing event",
|
152
|
+
log_err("error when processing event",
|
156
153
|
:event => event,
|
157
154
|
:message => exception.message,
|
158
155
|
:class => exception.class.name,
|
159
|
-
:backtrace => exception.backtrace
|
160
|
-
)
|
156
|
+
:backtrace => exception.backtrace)
|
161
157
|
end
|
162
158
|
end # def receive
|
163
159
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-sumologic'
|
3
|
-
s.version = '1.2.
|
3
|
+
s.version = '1.2.1'
|
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.'
|
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.2.
|
4
|
+
version: 1.2.1
|
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-
|
11
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: manticore
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.7.
|
149
|
+
rubygems_version: 2.7.8
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Deliever the log to Sumo Logic cloud service.
|