fluent-plugin-logzio 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/fluent-plugin-logzio.gemspec +1 -1
- data/lib/fluent/plugin/out_logzio_buffered.rb +32 -38
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88fbcbf908f73177e386858478a979f45beb63c5
|
4
|
+
data.tar.gz: bd27f0a066852955f52414197d72d6be87f6e023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 597e9edb06b3aad61358d49541bb69405e5c6b4f2853ef7ed2bdc08f356b5e1642675a82c1628cba32b77bd37715ae95c5d97ad298588a165b8b1ae779f8c081
|
7
|
+
data.tar.gz: b423b45d6d6749c6dbe480511e8ba0bda2d1dda126c4c006d23c3e47fdc39b3f278f98f07d029a7675485bf56792a7b24bae04e627cc25eb75f4c1b05f1611e9
|
data/README.md
CHANGED
@@ -33,5 +33,6 @@ With fluent-plugin-logzio you will be able to use [Logz.io](http://logz.io) as o
|
|
33
33
|
|
34
34
|
|
35
35
|
## Release Notes
|
36
|
+
- 0.0.14: Refactor send function to handle more cases, and retry in case of logzio connection failure
|
36
37
|
- 0.0.13: BREAKING - Removed non-buffered version. It's really not efficient, and should just not be used. If you are using this version, you should change to the buffered one.
|
37
38
|
- 0.0.12: Catch exception when parsing YAML to ignore (instead of crash) not valid logs
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'fluent-plugin-logzio'
|
7
|
-
s.version = '0.0.
|
7
|
+
s.version = '0.0.14'
|
8
8
|
s.authors = ['Yury Kotov', 'Roi Rav-Hon']
|
9
9
|
s.email = ['bairkan@gmail.com', 'roi@logz.io']
|
10
10
|
s.homepage = 'https://github.com/logzio/fluent-plugin-logzio'
|
@@ -4,7 +4,7 @@ module Fluent
|
|
4
4
|
config_param :endpoint_url, :string, default: nil
|
5
5
|
config_param :output_include_time, :bool, default: true
|
6
6
|
config_param :output_include_tags, :bool, default: true
|
7
|
-
config_param :retry_count, :integer, default:
|
7
|
+
config_param :retry_count, :integer, default: 4 # How many times to resend failed bulks. Undocumented because not suppose to be changed
|
8
8
|
config_param :http_idle_timeout, :integer, default: 5
|
9
9
|
config_param :output_tags_fieldname, :string, default: 'fluentd_tags'
|
10
10
|
|
@@ -57,50 +57,44 @@ module Fluent
|
|
57
57
|
# Logz.io bulk http endpoint expecting log line with \n delimiter
|
58
58
|
post.body = records.join("\n")
|
59
59
|
|
60
|
-
|
61
|
-
response = @http.request @uri, post
|
62
|
-
should_retry = true
|
63
|
-
|
64
|
-
if response.code != '200'
|
65
|
-
if response.code == '401'
|
66
|
-
log.error("You are not authorized with Logz.io! Token OK? dropping logs...")
|
67
|
-
should_retry = false
|
68
|
-
end
|
60
|
+
sleep_interval = 2
|
69
61
|
|
70
|
-
|
71
|
-
|
72
|
-
|
62
|
+
begin
|
63
|
+
@retry_count.times do |counter|
|
64
|
+
should_retry = true
|
65
|
+
begin
|
66
|
+
response = @http.request @uri, post
|
67
|
+
if response.code != '200'
|
68
|
+
if response.code == '401'
|
69
|
+
log.error "You are not authorized with Logz.io! Token OK? dropping logs..."
|
70
|
+
should_retry = false
|
71
|
+
elsif response.code == '400'
|
72
|
+
log.info "Got 400 code from Logz.io. This means that some of your logs are too big, or badly formatted. Response: #{response.body}"
|
73
|
+
should_retry = false
|
74
|
+
else
|
75
|
+
log.debug "Got HTTP #{response.code} from logz.io, not giving up just yet (Try #{counter + 1}/#{@retry_count})"
|
76
|
+
end
|
77
|
+
else
|
78
|
+
log.debug "Successfuly sent bulk"
|
79
|
+
should_retry = false
|
80
|
+
end
|
81
|
+
rescue StandardError => e
|
82
|
+
log.debug "Error connecting to logzio. Got exception: #{e} (Try #{counter + 1}/#{@retry_count})"
|
73
83
|
end
|
74
84
|
|
75
|
-
# If any other non-200 or 400/401, we will try to resend it after 2, 4 and 8 seconds. Then we will give up
|
76
|
-
sleep_interval = 2
|
77
|
-
|
78
85
|
if should_retry
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
sleep(sleep_interval)
|
83
|
-
|
84
|
-
# Retry
|
85
|
-
response = @http.request @uri, post
|
86
|
-
|
87
|
-
# Sucecss, no further action is needed
|
88
|
-
if response.code == 200
|
89
|
-
log.debug "Successfuly sent the failed bulk."
|
90
|
-
break
|
91
|
-
else
|
92
|
-
# Doubling the sleep interval
|
93
|
-
sleep_interval *= 2
|
94
|
-
|
95
|
-
if counter == @retry_count - 1
|
96
|
-
log.error "Could not send your bulk after 3 tries. Sorry. Got HTTP #{response.code} with body: #{response.body}"
|
97
|
-
end
|
98
|
-
end
|
86
|
+
if counter == @retry_count - 1
|
87
|
+
log.error "Could not send your bulk after #{retry_count} tries. Sorry."
|
88
|
+
break
|
99
89
|
end
|
90
|
+
sleep(sleep_interval)
|
91
|
+
sleep_interval *= 2
|
92
|
+
else
|
93
|
+
return
|
100
94
|
end
|
101
95
|
end
|
102
|
-
rescue
|
103
|
-
log.error "
|
96
|
+
rescue Exception => e
|
97
|
+
log.error "Got unexpected exception! Here: #{e}"
|
104
98
|
end
|
105
99
|
end
|
106
100
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-logzio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Kotov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-http-persistent
|