fluent-plugin-google-cloud 0.5.3.grpc.alpha.2 → 0.5.3.grpc.alpha.3

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: d313f90fa86ac062a46a65bd400a8729085f4c3f
4
- data.tar.gz: 6a699b31b50a807178ebd97a913e47666c0f34b2
3
+ metadata.gz: cdae7652026e7ff5ad8ac5593c6ecf016948f41f
4
+ data.tar.gz: 85162c0a5db2c340faf21e60256a8c3fa66be30c
5
5
  SHA512:
6
- metadata.gz: fc3b4b13b78bf6c4d04976e79fd91f96801c85e0d26c7ffff93fcb4cc9e27c6d741626f2cd2bf89aeb53932d739568c05e0d3549a7746eec0b3b3ed97d22ab60
7
- data.tar.gz: 9edc718d851cb46e511743f16f0228167aafefd0e341a23b4619d57a95ec680e2d17025e7c5b146d435d96a4d79ebb00f4ea7f626e9c12da11d1a5f615486695
6
+ metadata.gz: bdc518fb676f756a572d16d0589ab7297bf2d67a78aac6ffb1772dafa0c2025ad33641c8290ac11c6d467704ab4bcb92b59bf6dc65cff2d23939636e470f88be
7
+ data.tar.gz: a209e99c4390c0661438cb24eeaa9628615743096d0021e001a327eac0a4ba2e1abc573adabfa98d0ba0e78ad779521ff046adcb3570e747037bd47b704481c2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-google-cloud (0.5.3.grpc.alpha.2)
4
+ fluent-plugin-google-cloud (0.5.3.grpc.alpha.3)
5
5
  fluentd (~> 0.10, <= 0.13)
6
6
  google-api-client (> 0.9)
7
7
  googleapis-common-protos (~> 1.3)
@@ -12,7 +12,8 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- addressable (2.4.0)
15
+ addressable (2.5.0)
16
+ public_suffix (~> 2.0, >= 2.0.2)
16
17
  ast (2.3.0)
17
18
  astrolabe (1.3.1)
18
19
  parser (~> 2.2)
@@ -21,7 +22,7 @@ GEM
21
22
  safe_yaml (~> 1.0.0)
22
23
  faraday (0.9.2)
23
24
  multipart-post (>= 1.2, < 3)
24
- fluentd (0.12.26)
25
+ fluentd (0.12.29)
25
26
  cool.io (>= 1.2.2, < 2.0.0)
26
27
  http_parser.rb (>= 0.5.1, < 0.7.0)
27
28
  json (>= 1.4.3)
@@ -31,7 +32,7 @@ GEM
31
32
  tzinfo (>= 1.0.0)
32
33
  tzinfo-data (>= 1.0.0)
33
34
  yajl-ruby (~> 1.0)
34
- google-api-client (0.9.13)
35
+ google-api-client (0.9.20)
35
36
  addressable (~> 2.3)
36
37
  googleauth (~> 0.5)
37
38
  httpclient (~> 2.7)
@@ -40,8 +41,8 @@ GEM
40
41
  mime-types (>= 1.6)
41
42
  representable (~> 2.3.0)
42
43
  retriable (~> 2.0)
43
- google-protobuf (3.0.0)
44
- googleapis-common-protos (1.3.0)
44
+ google-protobuf (3.0.2)
45
+ googleapis-common-protos (1.3.4)
45
46
  google-protobuf (~> 3.0)
46
47
  grpc (~> 1.0)
47
48
  googleauth (0.5.1)
@@ -52,15 +53,15 @@ GEM
52
53
  multi_json (~> 1.11)
53
54
  os (~> 0.9)
54
55
  signet (~> 0.7)
55
- grpc (1.0.0)
56
- google-protobuf (~> 3.0)
56
+ grpc (1.0.1)
57
+ google-protobuf (~> 3.0.2)
57
58
  googleauth (~> 0.5.1)
58
59
  hashdiff (0.3.0)
59
60
  http_parser.rb (0.6.0)
60
- httpclient (2.8.2.3)
61
+ httpclient (2.8.2.4)
61
62
  hurley (0.2)
62
63
  json (1.8.3)
63
- jwt (1.5.4)
64
+ jwt (1.5.6)
64
65
  little-plugger (1.1.4)
65
66
  logging (2.1.0)
66
67
  little-plugger (~> 1.1)
@@ -70,16 +71,17 @@ GEM
70
71
  mime-types (3.1)
71
72
  mime-types-data (~> 3.2015)
72
73
  mime-types-data (3.2016.0521)
73
- mocha (1.1.0)
74
+ mocha (1.2.1)
74
75
  metaclass (~> 0.0.1)
75
76
  msgpack (0.5.12)
76
77
  multi_json (1.12.1)
77
78
  multipart-post (2.0.0)
78
79
  os (0.9.6)
79
- parser (2.3.1.2)
80
+ parser (2.3.1.4)
80
81
  ast (~> 2.2)
81
- power_assert (0.3.0)
82
+ power_assert (0.3.1)
82
83
  powerpack (0.1.1)
84
+ public_suffix (2.0.4)
83
85
  rainbow (2.1.0)
84
86
  rake (10.5.0)
85
87
  representable (2.3.0)
@@ -100,19 +102,19 @@ GEM
100
102
  jwt (~> 1.5)
101
103
  multi_json (~> 1.10)
102
104
  string-scrub (0.0.5)
103
- test-unit (3.2.0)
105
+ test-unit (3.2.2)
104
106
  power_assert
105
107
  thread_safe (0.3.5)
106
108
  tzinfo (1.2.2)
107
109
  thread_safe (~> 0.1)
108
- tzinfo-data (1.2016.6)
110
+ tzinfo-data (1.2016.9)
109
111
  tzinfo (>= 1.0.0)
110
112
  uber (0.0.15)
111
113
  webmock (1.24.6)
112
114
  addressable (>= 2.3.6)
113
115
  crack (>= 0.3.2)
114
116
  hashdiff
115
- yajl-ruby (1.2.1)
117
+ yajl-ruby (1.3.0)
116
118
 
117
119
  PLATFORMS
118
120
  ruby
@@ -126,4 +128,4 @@ DEPENDENCIES
126
128
  webmock (~> 1.17)
127
129
 
128
130
  BUNDLED WITH
129
- 1.12.5
131
+ 1.13.6
@@ -10,7 +10,7 @@ eos
10
10
  gem.homepage = \
11
11
  'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud'
12
12
  gem.license = 'Apache-2.0'
13
- gem.version = '0.5.3.grpc.alpha.2'
13
+ gem.version = '0.5.3.grpc.alpha.3'
14
14
  gem.authors = ['Todd Derr', 'Alex Robinson']
15
15
  gem.email = ['salty@google.com']
16
16
  gem.required_ruby_version = Gem::Requirement.new('>= 2.0')
@@ -30,7 +30,7 @@ module Fluent
30
30
  Fluent::Plugin.register_output('google_cloud', self)
31
31
 
32
32
  PLUGIN_NAME = 'Fluentd Google Cloud Logging plugin'
33
- PLUGIN_VERSION = '0.5.3.grpc.alpha.1'
33
+ PLUGIN_VERSION = '0.5.3.grpc.alpha.3'
34
34
 
35
35
  # Constants for service names.
36
36
  APPENGINE_SERVICE = 'appengine.googleapis.com'
@@ -122,6 +122,16 @@ module Fluent
122
122
  # Cloud Logging API.
123
123
  config_param :use_grpc, :bool, :default => false
124
124
 
125
+ # Whether to allow non-UTF-8 characters in user logs. If set to true, any
126
+ # non-UTF-8 character would be replaced by the string specified by
127
+ # 'non_utf8_replacement_string'. If set to false, any non-UTF-8 character
128
+ # would trigger the plugin to error out.
129
+ config_param :coerce_to_utf8, :bool, :default => true
130
+
131
+ # If 'coerce_to_utf8' is set to true, any non-UTF-8 character would be
132
+ # replaced by the string specified here.
133
+ config_param :non_utf8_replacement_string, :string, :default => ' '
134
+
125
135
  # DEPRECATED: The following parameters, if present in the config
126
136
  # indicate that the plugin configuration must be updated.
127
137
  config_param :auth_method, :string, :default => nil
@@ -363,9 +373,9 @@ module Fluent
363
373
  if @use_grpc
364
374
  entry = Google::Logging::V1::LogEntry.new(
365
375
  metadata: Google::Logging::V1::LogEntryMetadata.new(
366
- service_name: @service_name.encode('utf-8'),
367
- project_id: @project_id.encode('utf-8'),
368
- zone: @zone.encode('utf-8'),
376
+ service_name: convert_to_utf8(@service_name),
377
+ project_id: convert_to_utf8(@project_id),
378
+ zone: convert_to_utf8(@zone),
369
379
  labels: {}
370
380
  ))
371
381
  else
@@ -476,9 +486,9 @@ module Fluent
476
486
  client = api_client
477
487
 
478
488
  labels_utf8_pairs = labels.map do |k, v|
479
- [k.encode('utf-8'), v.encode('utf-8')]
489
+ [k.encode('utf-8'), convert_to_utf8(v)]
480
490
  end
481
- utf8_log_name = log_name.encode('utf-8')
491
+ utf8_log_name = convert_to_utf8(log_name)
482
492
 
483
493
  write_request = Google::Logging::V1::WriteLogEntriesRequest.new(
484
494
  log_name: "projects/#{@project_id}/logs/#{utf8_log_name}",
@@ -1308,7 +1318,7 @@ module Fluent
1308
1318
  when Numeric
1309
1319
  ret.number_value = value
1310
1320
  when String
1311
- ret.string_value = value.encode('utf-8')
1321
+ ret.string_value = convert_to_utf8(value)
1312
1322
  when TrueClass
1313
1323
  ret.bool_value = true
1314
1324
  when FalseClass
@@ -1352,15 +1362,16 @@ module Fluent
1352
1362
  # 2. This is an unstructured Container log and the 'log' key is available
1353
1363
  # 3. The only remaining key is 'message'
1354
1364
  if @service_name == CLOUDFUNCTIONS_SERVICE && @cloudfunctions_log_match
1355
- entry.text_payload = @cloudfunctions_log_match['text']
1365
+ entry.text_payload = convert_to_utf8(
1366
+ @cloudfunctions_log_match['text'])
1356
1367
  elsif @service_name == CLOUDFUNCTIONS_SERVICE && record.key?('log')
1357
- entry.text_payload = record['log']
1368
+ entry.text_payload = convert_to_utf8(record['log'])
1358
1369
  elsif is_json
1359
1370
  entry.struct_payload = struct_from_ruby(record)
1360
1371
  elsif @service_name == CONTAINER_SERVICE && record.key?('log')
1361
- entry.text_payload = record['log']
1372
+ entry.text_payload = convert_to_utf8(record['log'])
1362
1373
  elsif record.size == 1 && record.key?('message')
1363
- entry.text_payload = record['message']
1374
+ entry.text_payload = convert_to_utf8(record['message'])
1364
1375
  else
1365
1376
  entry.struct_payload = struct_from_ruby(record)
1366
1377
  end
@@ -1415,5 +1426,29 @@ module Fluent
1415
1426
  end
1416
1427
  @client
1417
1428
  end
1429
+
1430
+ # Encode as UTF-8. If 'coerce_to_utf8' is set to true in the config, any
1431
+ # non-UTF-8 character would be replaced by the string specified by
1432
+ # 'non_utf8_replacement_string'. If 'coerce_to_utf8' is set to false, any
1433
+ # non-UTF-8 character would trigger the plugin to error out.
1434
+ def convert_to_utf8(input)
1435
+ if @coerce_to_utf8
1436
+ input.encode(
1437
+ 'utf-8',
1438
+ invalid: :replace,
1439
+ undef: :replace,
1440
+ replace: @non_utf8_replacement_string)
1441
+ else
1442
+ begin
1443
+ input.encode('utf-8')
1444
+ rescue EncodingError
1445
+ @log.error 'Encountered encoding issues potentially due to non ' \
1446
+ 'UTF-8 characters. To allow non-UTF-8 characters and ' \
1447
+ 'replace them with spaces, please set "coerce_to_utf8" ' \
1448
+ 'to true.'
1449
+ raise
1450
+ end
1451
+ end
1452
+ end
1418
1453
  end
1419
1454
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-google-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3.grpc.alpha.2
4
+ version: 0.5.3.grpc.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Derr
@@ -9,124 +9,124 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-07 00:00:00.000000000 Z
12
+ date: 2016-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0.10'
21
- - - "<="
21
+ - - <=
22
22
  - !ruby/object:Gem::Version
23
23
  version: '0.13'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ~>
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0.10'
31
- - - "<="
31
+ - - <=
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.13'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: googleapis-common-protos
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: google-api-client
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">"
52
+ - - '>'
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.9'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">"
59
+ - - '>'
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.9'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: googleauth
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.4'
69
69
  type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.4'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: grpc
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.0'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: json
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.8'
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.8'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: mocha
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.1'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.1'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rake
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '10.3'
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: '10.3'
132
132
  - !ruby/object:Gem::Dependency
@@ -147,28 +147,28 @@ dependencies:
147
147
  name: webmock
148
148
  requirement: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: '1.17'
153
153
  type: :development
154
154
  prerelease: false
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ~>
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.17'
160
160
  - !ruby/object:Gem::Dependency
161
161
  name: test-unit
162
162
  requirement: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ~>
165
165
  - !ruby/object:Gem::Version
166
166
  version: '3.0'
167
167
  type: :development
168
168
  prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ~>
172
172
  - !ruby/object:Gem::Version
173
173
  version: '3.0'
174
174
  description: |2
@@ -211,12 +211,12 @@ require_paths:
211
211
  - lib
212
212
  required_ruby_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
- - - ">="
214
+ - - '>='
215
215
  - !ruby/object:Gem::Version
216
216
  version: '2.0'
217
217
  required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  requirements:
219
- - - ">"
219
+ - - '>'
220
220
  - !ruby/object:Gem::Version
221
221
  version: 1.3.1
222
222
  requirements: []