fluent-plugin-cloudwatch-logs 0.2.6 → 0.3.0

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
  SHA1:
3
- metadata.gz: ea446d3a1a05b1a484323cb46096a44f7aed765a
4
- data.tar.gz: cafcf79e24b288ed07b6585eb253f204da92c762
3
+ metadata.gz: d4238d9fd741cabef203f35c414b70d13955314f
4
+ data.tar.gz: d8f44326e2452d24b3f33c0cf2950a09187ec664
5
5
  SHA512:
6
- metadata.gz: e5c6b86471a03fd306f247d85e28389bcd0dd0bd7b6e7e33ad9bbc49bf543f14c572127c649066b3a663fd8ac3cff78894b7be3147c2c01fe5876be750884cd7
7
- data.tar.gz: d399ec8bf3e3704a0d9cf85bea432c0dd817f933ed2039d9459ceff03c162d9c6b59775a70c5e3a5b084b85f71097799c8191d15253bd75eb2aed744d6f87432
6
+ metadata.gz: 4cfa93793297b5cd39addae8ec7b6b18c641cebe06a54392558811a292086c78f22edd4e9ca5676750b9d290dc671b3a087723570571579b344f410518a0dd5d
7
+ data.tar.gz: 3e7ab5bd33f70a58e086772bb92c39106ecec63471799559f6e12211f4e9536b5543c8d1b4afa987bc93f4f7ebe230eea4e17b0a3d12e2840f21ca268bd046a4
data/README.md CHANGED
@@ -146,6 +146,10 @@ Or, If you do not want to use IAM roll or ENV(this is just like writing to confi
146
146
  $ rake aws_key_id=YOUR_ACCESS_KEY aws_sec_key=YOUR_SECRET_KEY region=us-east-1 test
147
147
  ```
148
148
 
149
+ ## Caution
150
+
151
+ - If an event message exceeds API limit (256KB), the event will be discarded.
152
+
149
153
  ## TODO
150
154
 
151
155
  * out_cloudwatch_logs
@@ -2,7 +2,7 @@ module Fluent
2
2
  module Plugin
3
3
  module Cloudwatch
4
4
  module Logs
5
- VERSION = "0.2.6"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
8
8
  end
@@ -28,6 +28,7 @@ module Fluent
28
28
  config_param :put_log_events_disable_retry_limit, :bool, default: false
29
29
 
30
30
  MAX_EVENTS_SIZE = 1_048_576
31
+ MAX_EVENT_SIZE = 256 * 1024
31
32
  EVENT_HEADER_SIZE = 26
32
33
 
33
34
  unless method_defined?(:log)
@@ -164,8 +165,13 @@ module Fluent
164
165
  # http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
165
166
  total_bytesize = 0
166
167
  while event = events.shift
167
- new_chunk = chunk + [event]
168
168
  event_bytesize = event[:message].bytesize + EVENT_HEADER_SIZE
169
+ if MAX_EVENT_SIZE < event_bytesize
170
+ log.warn "Log event is discarded because it is too large: #{event_bytesize} bytes exceeds limit of #{MAX_EVENT_SIZE}"
171
+ break
172
+ end
173
+
174
+ new_chunk = chunk + [event]
169
175
 
170
176
  chunk_span_too_big = new_chunk.size > 1 && new_chunk[-1][:timestamp] - new_chunk[0][:timestamp] >= 1000 * 60 * 60 * 24
171
177
  chunk_too_big = total_bytesize + event_bytesize > MAX_EVENTS_SIZE
@@ -334,6 +334,19 @@ put_log_events_retry_limit 1
334
334
  assert_match(/failed to PutLogEvents and throwing away/, d.instance.log.logs[5])
335
335
  end
336
336
 
337
+ def test_too_large_event
338
+ time = Time.now
339
+ d = create_driver(<<-EOC)
340
+ #{default_config}
341
+ log_group_name #{log_group_name}
342
+ log_stream_name #{log_stream_name}
343
+ EOC
344
+ d.emit({'message' => '*' * 256 * 1024}, time.to_i)
345
+ d.run
346
+
347
+ assert_match(/Log event is discarded because it is too large: 262184 bytes exceeds limit of 262144$/, d.instance.log.logs[0])
348
+ end
349
+
337
350
  private
338
351
  def default_config
339
352
  <<-EOC
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cloudwatch-logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd