fluent-plugin-cloudwatch-logs 0.3.2 → 0.3.3
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/Gemfile +1 -0
- data/lib/fluent/plugin/cloudwatch/logs/version.rb +1 -1
- data/lib/fluent/plugin/out_cloudwatch_logs.rb +12 -4
- data/test/plugin/test_out_cloudwatch_logs.rb +19 -0
- 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: e8dbf3d1910a3b9441394ff31f94fb1ce16813b3
|
4
|
+
data.tar.gz: 12284873b4ead473926e40db48a7b356cd82a7e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3844ad5b634e937af8843426fada5ff7d7f3dc4ebea0ecd86936862e981ec582373f20108e8013758922340961b4a9e99a591aa049887a9129eee2e994be62e4
|
7
|
+
data.tar.gz: c695b70a2e4a2f4ebf14adc0181f667a04e35cf3996405e397ec6d3480f8ad3604cefb4b1f8f38bc2f62364a93e3fdd32e41d1137d70eb339313e0d2bd6319db
|
data/Gemfile
CHANGED
@@ -126,16 +126,13 @@ module Fluent
|
|
126
126
|
rs.each do |t, time, record|
|
127
127
|
time_ms = time * 1000
|
128
128
|
|
129
|
+
scrub_record!(record)
|
129
130
|
if @message_keys
|
130
131
|
message = @message_keys.split(',').map {|k| record[k].to_s }.join(' ')
|
131
132
|
else
|
132
133
|
message = record.to_json
|
133
134
|
end
|
134
135
|
|
135
|
-
# CloudWatchLogs API only accepts valid UTF-8 strings
|
136
|
-
# so we should encode the message to UTF-8
|
137
|
-
message.encode('UTF-8', :invalid => :replace)
|
138
|
-
|
139
136
|
if @max_message_length
|
140
137
|
message = message.slice(0, @max_message_length)
|
141
138
|
end
|
@@ -150,6 +147,17 @@ module Fluent
|
|
150
147
|
end
|
151
148
|
|
152
149
|
private
|
150
|
+
def scrub_record!(record)
|
151
|
+
case record
|
152
|
+
when Hash
|
153
|
+
record.each_value {|v| scrub_record!(v) }
|
154
|
+
when Array
|
155
|
+
record.each {|v| scrub_record!(v) }
|
156
|
+
when String
|
157
|
+
record.scrub!
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
153
161
|
def next_sequence_token(group_name, stream_name)
|
154
162
|
@sequence_tokens[group_name][stream_name]
|
155
163
|
end
|
@@ -366,6 +366,25 @@ log_stream_name #{log_stream_name}
|
|
366
366
|
assert_match(/Log event is discarded because it is too large: 262184 bytes exceeds limit of 262144$/, d.instance.log.logs[0])
|
367
367
|
end
|
368
368
|
|
369
|
+
def test_scrub_record
|
370
|
+
record = {
|
371
|
+
"hash" => {
|
372
|
+
"str" => "\xAE",
|
373
|
+
},
|
374
|
+
"array" => [
|
375
|
+
"\xAE",
|
376
|
+
],
|
377
|
+
"str" => "\xAE",
|
378
|
+
}
|
379
|
+
|
380
|
+
d = create_driver
|
381
|
+
d.instance.send(:scrub_record!, record)
|
382
|
+
|
383
|
+
assert_equal("�", record["hash"]["str"])
|
384
|
+
assert_equal("�", record["array"][0])
|
385
|
+
assert_equal("�", record["str"])
|
386
|
+
end
|
387
|
+
|
369
388
|
private
|
370
389
|
def default_config
|
371
390
|
<<-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.3.
|
4
|
+
version: 0.3.3
|
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-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|