fluent-plugin-logzio 0.0.21 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6b850642fbf62e80b5033d03300ea4cbb3e600484836ae411877546785182a3
4
- data.tar.gz: 2a40dc72118892e5bdf8bbf2becf44e6e2bf8688470034ae0152fb918b05a481
3
+ metadata.gz: de65dcc352aca420ba2469b1c31c0c3f135309b7728d501ca1eb27e09259e322
4
+ data.tar.gz: b92016ff7b59405e6e9d45b24ae87fb0d60d396b06bc6ae81b681991d45a56ea
5
5
  SHA512:
6
- metadata.gz: b98047acec6ffededc5c44f22ac3f2b451da2fc5c3b6a9d0b32f7d1e1a5e838f06c5ab1cdb4754f30500817a74bfebcbf0e92d1583b14d48f085ce348a203e7b
7
- data.tar.gz: c05ed2eb34bd102938d8b00708ffa6ac0978b5420d46001925dcf0a9042e9b46ec14868b42b6396eb0c0be80663d81579186c58ed1fb2650643bd6ce52f10fa1
6
+ metadata.gz: f167bd4d0d6c60612dff909d2490d734808eb07894c7396af321351ae741c8fc9b60193209ff92819a50f74089c4d72f91bf24393e27f74a2da3246fef22d5a3
7
+ data.tar.gz: ccb0be4ca90d64ac4626adc6efbc05f46fde74bad6b505535c298f6b824a6e4e8d349a21128cddd211c212f730f9501c75b76c5f9c02efed096ea05e44a967de
@@ -0,0 +1,8 @@
1
+ repos:
2
+ - repo: https://github.com/cycodehq-public/cycode-cli
3
+ rev: 0.1.6
4
+ hooks:
5
+ - id: cycode
6
+ language_version: python3
7
+ stages:
8
+ - commit
data/README.md CHANGED
@@ -69,12 +69,15 @@ This is an **example** only. Your needs in production may vary!
69
69
  * **retry_sleep** How long to sleep initially between retries, exponential step-off. Initial default is 2s.
70
70
  * **bulk_limit** Limit to the size of the Logz.io upload bulk. Defaults to 1000000 bytes leaving about 24kB for overhead.
71
71
  * **bulk_limit_warning_limit** Limit to the size of the Logz.io warning message when a record exceeds bulk_limit to prevent a recursion when Fluent warnings are sent to the Logz.io output. Defaults to nil (no truncation).
72
- * **proxy_uri** Your proxy uri. Default is nil
72
+ * **proxy_uri** Your proxy uri. Default is nil. For example: "`my.ip:12345`".
73
73
  * **proxy_cert** Your proxy cert. Default is nil
74
74
  * **gzip** should the plugin ship the logs in gzip compression. Default is false
75
75
 
76
76
 
77
77
  ## Release Notes
78
+ - **0.1.0**:
79
+ - Use fluentd's retry instead of retry in code (raise exception on non-2xx response).
80
+ - 0.0.22: Update gem `net-http-persistent` to 4.x.
78
81
  - 0.0.21: Update gem `net-http-persistent` to 3.x.
79
82
  - 0.0.20: Support gzip compression
80
83
  - 0.0.18: Support proxy_uri and proxy_cert in the configuration file. Put logzio output plugin class under Fluent::Plugin module and thus work with multi workers.
@@ -4,8 +4,8 @@ $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.21'
8
- s.authors = ['Yury Kotov', 'Roi Rav-Hon', 'Arcadiy Ivanov', 'Miri Ignatiev']
7
+ s.version = '0.1.0'
8
+ s.authors = ['Yury Kotov', 'Roi Rav-Hon', 'Arcadiy Ivanov', 'Miri Bar']
9
9
  s.email = ['bairkan@gmail.com', 'roi@logz.io', 'arcadiy@ivanov.biz', 'miri.ignatiev@logz.io']
10
10
  s.homepage = 'https://github.com/logzio/fluent-plugin-logzio'
11
11
  s.summary = %q{Fluentd plugin for output to Logz.io}
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ['lib']
20
20
  s.required_ruby_version = Gem::Requirement.new('>= 2.1.0')
21
21
 
22
- s.add_dependency 'net-http-persistent', '~> 3.0'
22
+ s.add_dependency 'net-http-persistent', '~> 4.0'
23
23
  s.add_runtime_dependency 'fluentd', ['>= 0.14.0', '< 2']
24
24
  s.add_development_dependency 'rake', '~> 12.3'
25
25
  s.add_development_dependency 'bundler', '~> 1.16'
@@ -131,45 +131,21 @@ module Fluent::Plugin
131
131
  if gzip
132
132
  post.body = compress(post.body)
133
133
  end
134
- sleep_interval = @retry_sleep
135
134
 
136
135
  begin
137
- @retry_count.times do |counter|
138
- should_retry = true
139
- begin
140
- response = @http.request @uri, post
141
- if response.code != '200'
142
- if response.code == '401'
143
- log.error "You are not authorized with Logz.io! Token OK? dropping logs..."
144
- should_retry = false
145
- elsif response.code == '400'
146
- log.info "Got 400 code from Logz.io. This means that some of your logs are too big, or badly formatted. Response: #{response.body}"
147
- should_retry = false
148
- else
149
- log.warn "Got HTTP #{response.code} from Logz.io, not giving up just yet (Try #{counter + 1}/#{@retry_count})"
150
- end
151
- else
152
- log.debug "Successfully sent bulk of #{bulk_records.size} records, size #{bulk_size}B to Logz.io"
153
- should_retry = false
154
- end
155
- rescue StandardError => e
156
- log.warn "Error connecting to Logz.io. Got exception: #{e} (Try #{counter + 1}/#{@retry_count})"
157
- end
136
+ response = @http.request @uri, post
137
+ rescue Net::HTTP::Persistent::Error => e
138
+ raise e.cause
139
+ end
158
140
 
159
- if should_retry
160
- if counter == @retry_count - 1
161
- log.error "Could not send your bulk after #{retry_count} tries Sorry! Your bulk is: #{post.body}"
162
- break
163
- end
164
- sleep(sleep_interval)
165
- sleep_interval *= 2
166
- else
167
- return
168
- end
169
- end
170
- rescue Exception => e
171
- log.error "Got unexpected exception! Here: #{e}"
141
+ resp_err = response.code.to_s.start_with?('4') || response.code.to_s.start_with?('5')
142
+
143
+ if not response.code.start_with?('2')
144
+ log.debug "Failed request body: #{post.body}"
145
+ log.error "Error while sending POST to #{@uri}: #{response.body}"
172
146
  end
147
+
148
+ raise "Logzio listener returned (#{response.code}) for #{@uri}: #{response.body}" if resp_err
173
149
  end
174
150
 
175
151
  def compress(string)
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-logzio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Kotov
8
8
  - Roi Rav-Hon
9
9
  - Arcadiy Ivanov
10
- - Miri Ignatiev
10
+ - Miri Bar
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-03-01 00:00:00.000000000 Z
14
+ date: 2023-05-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: net-http-persistent
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '3.0'
22
+ version: '4.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '3.0'
29
+ version: '4.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: fluentd
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +114,7 @@ extensions: []
114
114
  extra_rdoc_files: []
115
115
  files:
116
116
  - ".gitignore"
117
+ - ".pre-commit-config.yaml"
117
118
  - ".rspec"
118
119
  - ".whitesource"
119
120
  - Gemfile
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  requirements: []
148
- rubygems_version: 3.0.3
149
+ rubygems_version: 3.0.3.1
149
150
  signing_key:
150
151
  specification_version: 4
151
152
  summary: Fluentd plugin for output to Logz.io