fluent-plugin-google-cloud 0.4.14 → 0.4.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NGQxM2IzZmRjNjdmOTQ0ZmE3ZDVjNmNkOTIzZWU4YjQxZDk4YjU2Mw==
5
+ data.tar.gz: !binary |-
6
+ M2UwYzcyNzUyNzI2NTM1YTUzMDk4N2EyNzlmMzA0MGVkMWJjNjZhNw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OGQ4ZGQ2MDljOTJkNjA0ODZhYTUwYTQ0OWZhYTIyOWU5YTE3YTA4MTM0ODQz
10
+ NWYzYjVlMjg1ZDA4MzgwMTVmZGYwODE5MzU2NGM5OGQ4NzJkNDIzNjMwMGMw
11
+ OGRhOTYyOTcyMmNjNjJiZGYyMDg3Y2UzNzM0YjY3Y2QwNDBiZWY=
12
+ data.tar.gz: !binary |-
13
+ NGM5MTdhM2ExYjIzZGYwMGM3NjgwZjQyYWQ5NWE4NGIzNWFjZmNmMjE0OTNk
14
+ YjQ5N2EwM2ZmOGE2Njc5NGE1NDM5MTYzMjExNjQ5ZmMxMzkxNzZkNWViODMz
15
+ M2YyNGE5MzFiM2ZjZjUzOTMxZWQyZGQxNTc4M2I1M2ZmMjdiZjE=
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-google-cloud (0.4.12)
4
+ fluent-plugin-google-cloud (0.4.14)
5
5
  fluentd (~> 0.10)
6
- google-api-client (>= 0.8.6, <= 0.9)
6
+ google-api-client (>= 0.8.6, < 0.9)
7
7
  googleauth (~> 0.4)
8
8
  json (~> 1.8)
9
+ jwt (< 1.5.3)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- activesupport (4.2.4)
14
+ activesupport (4.2.6)
14
15
  i18n (~> 0.7)
15
16
  json (~> 1.7, >= 1.7.7)
16
17
  minitest (~> 5.1)
@@ -24,13 +25,13 @@ GEM
24
25
  addressable (>= 2.3.1)
25
26
  extlib (>= 0.9.15)
26
27
  multi_json (>= 1.0.0)
27
- cool.io (1.4.1)
28
+ cool.io (1.4.3)
28
29
  crack (0.4.2)
29
30
  safe_yaml (~> 1.0.0)
30
31
  extlib (0.9.16)
31
32
  faraday (0.9.2)
32
33
  multipart-post (>= 1.2, < 3)
33
- fluentd (0.12.16)
34
+ fluentd (0.12.22)
34
35
  cool.io (>= 1.2.2, < 2.0.0)
35
36
  http_parser.rb (>= 0.5.1, < 0.7.0)
36
37
  json (>= 1.4.3)
@@ -51,13 +52,14 @@ GEM
51
52
  multi_json (~> 1.10)
52
53
  retriable (~> 1.4)
53
54
  signet (~> 0.6)
54
- googleauth (0.4.2)
55
+ googleauth (0.5.1)
55
56
  faraday (~> 0.9)
56
57
  jwt (~> 1.4)
57
58
  logging (~> 2.0)
58
59
  memoist (~> 0.12)
59
60
  multi_json (~> 1.11)
60
- signet (~> 0.6)
61
+ os (~> 0.9)
62
+ signet (~> 0.7)
61
63
  hashdiff (0.2.2)
62
64
  http_parser.rb (0.6.0)
63
65
  i18n (0.7.0)
@@ -66,17 +68,18 @@ GEM
66
68
  launchy (2.4.3)
67
69
  addressable (~> 2.3)
68
70
  little-plugger (1.1.4)
69
- logging (2.0.0)
71
+ logging (2.1.0)
70
72
  little-plugger (~> 1.1)
71
73
  multi_json (~> 1.10)
72
- memoist (0.12.0)
74
+ memoist (0.14.0)
73
75
  metaclass (0.0.4)
74
- minitest (5.8.2)
76
+ minitest (5.8.4)
75
77
  mocha (1.1.0)
76
78
  metaclass (~> 0.0.1)
77
79
  msgpack (0.5.12)
78
80
  multi_json (1.11.2)
79
81
  multipart-post (2.0.0)
82
+ os (0.9.6)
80
83
  parser (2.2.3.0)
81
84
  ast (>= 1.1, < 3.0)
82
85
  power_assert (0.2.5)
@@ -92,10 +95,9 @@ GEM
92
95
  ruby-progressbar (~> 1.4)
93
96
  ruby-progressbar (1.7.5)
94
97
  safe_yaml (1.0.4)
95
- sigdump (0.2.3)
96
- signet (0.6.1)
98
+ sigdump (0.2.4)
99
+ signet (0.7.2)
97
100
  addressable (~> 2.3)
98
- extlib (~> 0.9)
99
101
  faraday (~> 0.9)
100
102
  jwt (~> 1.5)
101
103
  multi_json (~> 1.10)
@@ -105,7 +107,7 @@ GEM
105
107
  thread_safe (0.3.5)
106
108
  tzinfo (1.2.2)
107
109
  thread_safe (~> 0.1)
108
- tzinfo-data (1.2015.7)
110
+ tzinfo-data (1.2016.2)
109
111
  tzinfo (>= 1.0.0)
110
112
  webmock (1.22.3)
111
113
  addressable (>= 2.3.6)
@@ -123,6 +125,3 @@ DEPENDENCIES
123
125
  rubocop (= 0.34.2)
124
126
  test-unit (~> 3.0)
125
127
  webmock (~> 1.17)
126
-
127
- BUNDLED WITH
128
- 1.10.6
@@ -9,8 +9,8 @@ eos
9
9
  gem.summary = 'fluentd output plugin for the Google Cloud Logging API'
10
10
  gem.homepage = \
11
11
  'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud'
12
- gem.license = 'Apache 2.0'
13
- gem.version = '0.4.14'
12
+ gem.license = 'Apache-2.0'
13
+ gem.version = '0.4.15'
14
14
  gem.authors = ['Todd Derr', 'Alex Robinson']
15
15
  gem.email = ['salty@google.com']
16
16
 
@@ -22,6 +22,9 @@ eos
22
22
  gem.add_runtime_dependency 'google-api-client', '>= 0.8.6', '< 0.9'
23
23
  gem.add_runtime_dependency 'googleauth', '~> 0.4'
24
24
  gem.add_runtime_dependency 'json', '~> 1.8'
25
+ # workaround for jwt 1.5.3 breaking ruby 1.9 support (included by googleauth)
26
+ # see https://github.com/jwt/ruby-jwt/issues/132
27
+ gem.add_runtime_dependency 'jwt', '< 1.5.3'
25
28
 
26
29
  gem.add_development_dependency 'mocha', '~> 1.1'
27
30
  gem.add_development_dependency 'rake', '~> 10.3'
@@ -31,6 +31,11 @@ module Fluent
31
31
  # Address of the metadata service.
32
32
  METADATA_SERVICE_ADDR = '169.254.169.254'
33
33
 
34
+ # Fields allowed in httpRequest object
35
+ HTTP_REQUEST_FIELDS = %w(requestMethod requestUrl requestSize status
36
+ responseSize userAgent remoteIp referer
37
+ cacheHit validatedWithOriginServer)
38
+
34
39
  # Disable this warning to conform to fluentd config_param conventions.
35
40
  # rubocop:disable Style/HashSyntax
36
41
 
@@ -434,6 +439,8 @@ module Fluent
434
439
 
435
440
  set_severity(record, entry)
436
441
 
442
+ set_http_request(record, entry)
443
+
437
444
  # If a field is present in the label_map, send its value as a label
438
445
  # (mapping the field name to label name as specified in the config)
439
446
  # and do not send that field as part of the payload.
@@ -656,6 +663,21 @@ module Fluent
656
663
  end
657
664
  end
658
665
 
666
+ def set_http_request(record, entry)
667
+ return unless record['httpRequest'].is_a?(Hash)
668
+
669
+ entry['httpRequest'] = {}
670
+
671
+ HTTP_REQUEST_FIELDS.each do |field|
672
+ if record['httpRequest'].key?(field)
673
+ entry['httpRequest'][field] = record['httpRequest'][field]
674
+ record['httpRequest'].delete(field)
675
+ end
676
+ end
677
+
678
+ record.delete('httpRequest') if record['httpRequest'].empty?
679
+ end
680
+
659
681
  # Values permitted by the API for 'severity' (which is an enum).
660
682
  VALID_SEVERITIES = Set.new(
661
683
  %w(DEFAULT DEBUG INFO NOTICE WARNING ERROR CRITICAL ALERT EMERGENCY))
@@ -787,7 +809,7 @@ module Fluent
787
809
  def init_api_client
788
810
  @client = Google::APIClient.new(
789
811
  application_name: 'Fluentd Google Cloud Logging plugin',
790
- application_version: '0.4.14',
812
+ application_version: '0.4.15',
791
813
  retries: 1)
792
814
 
793
815
  if @auth_method == 'private_key'
@@ -299,6 +299,19 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
299
299
  }
300
300
  }
301
301
 
302
+ HTTP_REQUEST_MESSAGE = {
303
+ 'requestMethod' => 'POST',
304
+ 'requestUrl' => 'http://example/',
305
+ 'requestSize' => 210,
306
+ 'status' => 200,
307
+ 'responseSize' => 65,
308
+ 'userAgent' => 'USER AGENT 1.0',
309
+ 'remoteIp' => '55.55.55.55',
310
+ 'referer' => 'http://referer/',
311
+ 'cacheHit' => false,
312
+ 'validatedWithOriginServer' => true
313
+ }
314
+
302
315
  def create_driver(conf = APPLICATION_DEFAULT_CONFIG, tag = 'test')
303
316
  Fluent::Test::BufferedOutputTestDriver.new(
304
317
  Fluent::GoogleCloudOutput, tag).configure(conf, use_v1_config: true)
@@ -1048,6 +1061,43 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
1048
1061
  end
1049
1062
  end
1050
1063
 
1064
+ def test_http_request_from_record
1065
+ setup_gce_metadata_stubs
1066
+ setup_logging_stubs
1067
+ d = create_driver(APPLICATION_DEFAULT_CONFIG)
1068
+ d.emit('httpRequest' => HTTP_REQUEST_MESSAGE)
1069
+ d.run
1070
+ verify_log_entries(1, COMPUTE_PARAMS, 'httpRequest') do |entry|
1071
+ assert_equal HTTP_REQUEST_MESSAGE, entry['httpRequest'], entry
1072
+ assert_equal nil, entry['structPayload']['httpRequest'], entry
1073
+ end
1074
+ end
1075
+
1076
+ def test_http_request_partial_from_record
1077
+ setup_gce_metadata_stubs
1078
+ setup_logging_stubs
1079
+ d = create_driver(APPLICATION_DEFAULT_CONFIG)
1080
+ d.emit('httpRequest' => HTTP_REQUEST_MESSAGE.merge('otherKey' => 'value'))
1081
+ d.run
1082
+ verify_log_entries(1, COMPUTE_PARAMS, 'httpRequest') do |entry|
1083
+ assert_equal HTTP_REQUEST_MESSAGE, entry['httpRequest'], entry
1084
+ assert_equal 'value', entry['structPayload']['httpRequest']['otherKey'],
1085
+ entry
1086
+ end
1087
+ end
1088
+
1089
+ def test_http_request_when_not_hash
1090
+ setup_gce_metadata_stubs
1091
+ setup_logging_stubs
1092
+ d = create_driver(APPLICATION_DEFAULT_CONFIG)
1093
+ d.emit('httpRequest' => 'a_string')
1094
+ d.run
1095
+ verify_log_entries(1, COMPUTE_PARAMS, 'structPayload') do |entry|
1096
+ assert_equal 'a_string', entry['structPayload']['httpRequest'], entry
1097
+ assert_equal nil, entry['httpRequest'], entry
1098
+ end
1099
+ end
1100
+
1051
1101
  # Make parse_severity public so we can test it.
1052
1102
  class Fluent::GoogleCloudOutput # rubocop:disable Style/ClassAndModuleChildren
1053
1103
  public :parse_severity
metadata CHANGED
@@ -1,8 +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.4.14
5
- prerelease:
4
+ version: 0.4.15
6
5
  platform: ruby
7
6
  authors:
8
7
  - Todd Derr
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2016-01-27 00:00:00.000000000 Z
12
+ date: 2016-03-18 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: fluentd
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ~>
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: google-api-client
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -42,7 +38,6 @@ dependencies:
42
38
  type: :runtime
43
39
  prerelease: false
44
40
  version_requirements: !ruby/object:Gem::Requirement
45
- none: false
46
41
  requirements:
47
42
  - - ! '>='
48
43
  - !ruby/object:Gem::Version
@@ -53,7 +48,6 @@ dependencies:
53
48
  - !ruby/object:Gem::Dependency
54
49
  name: googleauth
55
50
  requirement: !ruby/object:Gem::Requirement
56
- none: false
57
51
  requirements:
58
52
  - - ~>
59
53
  - !ruby/object:Gem::Version
@@ -61,7 +55,6 @@ dependencies:
61
55
  type: :runtime
62
56
  prerelease: false
63
57
  version_requirements: !ruby/object:Gem::Requirement
64
- none: false
65
58
  requirements:
66
59
  - - ~>
67
60
  - !ruby/object:Gem::Version
@@ -69,7 +62,6 @@ dependencies:
69
62
  - !ruby/object:Gem::Dependency
70
63
  name: json
71
64
  requirement: !ruby/object:Gem::Requirement
72
- none: false
73
65
  requirements:
74
66
  - - ~>
75
67
  - !ruby/object:Gem::Version
@@ -77,15 +69,27 @@ dependencies:
77
69
  type: :runtime
78
70
  prerelease: false
79
71
  version_requirements: !ruby/object:Gem::Requirement
80
- none: false
81
72
  requirements:
82
73
  - - ~>
83
74
  - !ruby/object:Gem::Version
84
75
  version: '1.8'
76
+ - !ruby/object:Gem::Dependency
77
+ name: jwt
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - <
81
+ - !ruby/object:Gem::Version
82
+ version: 1.5.3
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - <
88
+ - !ruby/object:Gem::Version
89
+ version: 1.5.3
85
90
  - !ruby/object:Gem::Dependency
86
91
  name: mocha
87
92
  requirement: !ruby/object:Gem::Requirement
88
- none: false
89
93
  requirements:
90
94
  - - ~>
91
95
  - !ruby/object:Gem::Version
@@ -93,7 +97,6 @@ dependencies:
93
97
  type: :development
94
98
  prerelease: false
95
99
  version_requirements: !ruby/object:Gem::Requirement
96
- none: false
97
100
  requirements:
98
101
  - - ~>
99
102
  - !ruby/object:Gem::Version
@@ -101,7 +104,6 @@ dependencies:
101
104
  - !ruby/object:Gem::Dependency
102
105
  name: rake
103
106
  requirement: !ruby/object:Gem::Requirement
104
- none: false
105
107
  requirements:
106
108
  - - ~>
107
109
  - !ruby/object:Gem::Version
@@ -109,7 +111,6 @@ dependencies:
109
111
  type: :development
110
112
  prerelease: false
111
113
  version_requirements: !ruby/object:Gem::Requirement
112
- none: false
113
114
  requirements:
114
115
  - - ~>
115
116
  - !ruby/object:Gem::Version
@@ -117,7 +118,6 @@ dependencies:
117
118
  - !ruby/object:Gem::Dependency
118
119
  name: rubocop
119
120
  requirement: !ruby/object:Gem::Requirement
120
- none: false
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
@@ -125,7 +125,6 @@ dependencies:
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
- none: false
129
128
  requirements:
130
129
  - - '='
131
130
  - !ruby/object:Gem::Version
@@ -133,7 +132,6 @@ dependencies:
133
132
  - !ruby/object:Gem::Dependency
134
133
  name: webmock
135
134
  requirement: !ruby/object:Gem::Requirement
136
- none: false
137
135
  requirements:
138
136
  - - ~>
139
137
  - !ruby/object:Gem::Version
@@ -141,7 +139,6 @@ dependencies:
141
139
  type: :development
142
140
  prerelease: false
143
141
  version_requirements: !ruby/object:Gem::Requirement
144
- none: false
145
142
  requirements:
146
143
  - - ~>
147
144
  - !ruby/object:Gem::Version
@@ -149,7 +146,6 @@ dependencies:
149
146
  - !ruby/object:Gem::Dependency
150
147
  name: test-unit
151
148
  requirement: !ruby/object:Gem::Requirement
152
- none: false
153
149
  requirements:
154
150
  - - ~>
155
151
  - !ruby/object:Gem::Version
@@ -157,7 +153,6 @@ dependencies:
157
153
  type: :development
158
154
  prerelease: false
159
155
  version_requirements: !ruby/object:Gem::Requirement
160
- none: false
161
156
  requirements:
162
157
  - - ~>
163
158
  - !ruby/object:Gem::Version
@@ -172,44 +167,43 @@ executables: []
172
167
  extensions: []
173
168
  extra_rdoc_files: []
174
169
  files:
170
+ - CONTRIBUTING
171
+ - Gemfile
172
+ - Gemfile.lock
173
+ - LICENSE
174
+ - README.rdoc
175
+ - Rakefile
176
+ - fluent-plugin-google-cloud.gemspec
177
+ - lib/fluent/plugin/out_google_cloud.rb
175
178
  - test/helper.rb
176
179
  - test/plugin/data/c31e573fd7f62ed495c9ca3821a5a85cb036dee1-privatekey.p12
177
180
  - test/plugin/data/credentials.json
178
181
  - test/plugin/data/iam-credentials.json
179
182
  - test/plugin/data/invalid_credentials.json
180
183
  - test/plugin/test_out_google_cloud.rb
181
- - LICENSE
182
- - Rakefile
183
- - fluent-plugin-google-cloud.gemspec
184
- - lib/fluent/plugin/out_google_cloud.rb
185
- - CONTRIBUTING
186
- - Gemfile.lock
187
- - Gemfile
188
- - README.rdoc
189
184
  homepage: https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud
190
185
  licenses:
191
- - Apache 2.0
186
+ - Apache-2.0
187
+ metadata: {}
192
188
  post_install_message:
193
189
  rdoc_options: []
194
190
  require_paths:
195
191
  - lib
196
192
  required_ruby_version: !ruby/object:Gem::Requirement
197
- none: false
198
193
  requirements:
199
194
  - - ! '>='
200
195
  - !ruby/object:Gem::Version
201
196
  version: '0'
202
197
  required_rubygems_version: !ruby/object:Gem::Requirement
203
- none: false
204
198
  requirements:
205
199
  - - ! '>='
206
200
  - !ruby/object:Gem::Version
207
201
  version: '0'
208
202
  requirements: []
209
203
  rubyforge_project:
210
- rubygems_version: 1.8.23
204
+ rubygems_version: 2.4.3
211
205
  signing_key:
212
- specification_version: 3
206
+ specification_version: 4
213
207
  summary: fluentd output plugin for the Google Cloud Logging API
214
208
  test_files:
215
209
  - test/helper.rb