fluent-plugin-s3 1.7.0 → 1.7.1

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: db01fa7706627c40baf9e272644c4449c47e4adac7c67ae336099c1c65021e04
4
- data.tar.gz: d74f9c06bcce4606b62d06ba416f934824213e42b508cf49dc093392c34692fe
3
+ metadata.gz: fe9afa0a2351dfffc6ea9afa0c2f3598a29b19a55fbfa22f58f3d17b606a3113
4
+ data.tar.gz: e5813910a178d16ed61c2a8782e2adeb394d0d256acfbcfdbead05069d789163
5
5
  SHA512:
6
- metadata.gz: 920c6ddc28b300bf9b00c2a21005d4adfeefc2e6c59ddb9afffedb2fcd45145baf70e2f7ec01997c12380d7b31def2289ece915a3099d0045b086314c914a555
7
- data.tar.gz: eb84c4fc47ad9840fb375d65f532f7f5df701ce733b8959c6e037ffd45010548555ae5695b9e0839d4af60967ec791b5cb4cd049e103653b7b441a4f2bf54209
6
+ metadata.gz: e3ca35df25975b7b57244c88d3145ab8fb5521054b863e030846a867bae6cbc9a69343f586f01b3a29d233eea787cf0ab540ff77edc0423d583394e29a192a7c
7
+ data.tar.gz: d46deabb1425e03250c9bc24578ad8dacef71cc445335ac9e4122b11c6ad91cf7a73f92b63d3688848ff35d427cb6371777f0011c94c45a898a6063edc1e3d9c
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ Release 1.7.1 - 2022/07/15
2
+
3
+ * in_s3: Add `match_regexp` parameter to selectively download S3 files based on the object key
4
+ * out_s3: Support `ssl_ca_bundle` and `ssl_ca_directory` parameter
5
+
1
6
  Release 1.7.0 - 2022/06/14
2
7
 
3
8
  * in_s3: Allow multi workers
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.7.1
data/docs/input.md CHANGED
@@ -18,6 +18,7 @@ See also [Configuration: credentials](credentials.md) for common comprehensive p
18
18
  s3_bucket YOUR_S3_BUCKET_NAME
19
19
  s3_region ap-northeast-1
20
20
  add_object_metadata true
21
+ match_regexp production_.*
21
22
 
22
23
  <sqs>
23
24
  queue_name YOUR_SQS_QUEUE_NAME
@@ -28,6 +29,10 @@ See also [Configuration: credentials](credentials.md) for common comprehensive p
28
29
 
29
30
  Whether or not object metadata should be added to the record. Defaults to `false`. See below for details.
30
31
 
32
+ ## match_regexp
33
+
34
+ If provided, process the S3 object only if its keys matches the regular expression
35
+
31
36
  ## s3_bucket (required)
32
37
 
33
38
  S3 bucket name.
data/docs/output.md CHANGED
@@ -81,6 +81,14 @@ This fixes the following error often seen in Windows:
81
81
 
82
82
  SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Seahorse::Client::NetworkingError)
83
83
 
84
+ ## ssl_ca_bundle
85
+
86
+ Full path to the SSL certificate authority bundle file that should be used when verifying peer certificates. If you do not pass `ssl_ca_bundle` or `ssl_ca_directory` the the system default will be used if available.
87
+
88
+ ## ssl_ca_directory
89
+
90
+ Full path of the directory that contains the unbundled SSL certificate authority files for verifying peer certificates. If you do not pass `ssl_ca_bundle` or `ssl_ca_directory` the the system default will be used if available.
91
+
84
92
  ## ssl_verify_peer
85
93
 
86
94
  Verify SSL certificate of the endpoint. Default is true. Set false when you want to ignore the endpoint SSL certificate.
@@ -90,6 +90,8 @@ module Fluent::Plugin
90
90
  config_param :check_apikey_on_start, :bool, default: true
91
91
  desc "URI of proxy environment"
92
92
  config_param :proxy_uri, :string, default: nil
93
+ desc "Optional RegEx to match incoming messages"
94
+ config_param :match_regexp, :regexp, default: nil
93
95
 
94
96
  config_section :sqs, required: true, multi: false do
95
97
  desc "SQS queue name"
@@ -204,7 +206,12 @@ module Fluent::Plugin
204
206
  body = Yajl.load(message.body)
205
207
  log.debug(body)
206
208
  next unless body["Records"] # skip test queue
207
-
209
+ if @match_regexp
210
+ s3 = body["Records"].first["s3"]
211
+ raw_key = s3["object"]["key"]
212
+ key = CGI.unescape(raw_key)
213
+ next unless @match_regexp.match?(key)
214
+ end
208
215
  process(body)
209
216
  rescue => e
210
217
  log.warn(error: e)
@@ -97,6 +97,10 @@ module Fluent::Plugin
97
97
  config_param :enable_dual_stack, :bool, default: false
98
98
  desc "If false, the certificate of endpoint will not be verified"
99
99
  config_param :ssl_verify_peer, :bool, :default => true
100
+ desc "Full path to the SSL certificate authority bundle file that should be used when verifying peer certificates. If unspecified, defaults to the system CA if available."
101
+ config_param :ssl_ca_bundle, :string, :default => nil
102
+ desc "Full path of the directory that contains the unbundled SSL certificate authority files for verifying peer certificates. If you do not pass ssl_ca_bundle or ssl_ca_directory the the system default will be used if available."
103
+ config_param :ssl_ca_directory, :string, :default => nil
100
104
  desc "The format of S3 object keys"
101
105
  config_param :s3_object_key_format, :string, default: "%{path}%{time_slice}_%{index}.%{file_extension}"
102
106
  desc "If true, the bucket name is always left in the request URI and never moved to the host as a sub-domain"
@@ -249,6 +253,8 @@ module Fluent::Plugin
249
253
  options[:compute_checksums] = @compute_checksums unless @compute_checksums.nil?
250
254
  options[:signature_version] = @signature_version unless @signature_version.nil?
251
255
  options[:ssl_verify_peer] = @ssl_verify_peer
256
+ options[:ssl_ca_bundle] = @ssl_ca_bundle if @ssl_ca_bundle
257
+ options[:ssl_ca_directory] = @ssl_ca_directory if @ssl_ca_directory
252
258
  log.on_trace do
253
259
  options[:http_wire_trace] = true
254
260
  options[:logger] = log
data/test/test_in_s3.rb CHANGED
@@ -613,4 +613,68 @@ EOS
613
613
  ]
614
614
  assert_equal(expected_records, events.map {|_tag, _time, record| record })
615
615
  end
616
+
617
+ def test_regexp_matching
618
+ setup_mocks
619
+ d = create_driver(CONFIG + "\ncheck_apikey_on_start false\nstore_as text\nformat none\nmatch_regexp .*_key?")
620
+
621
+ s3_object = stub(Object.new)
622
+ s3_response = stub(Object.new)
623
+ s3_response.body { StringIO.new("aaa bbb ccc") }
624
+ s3_object.get { s3_response }
625
+ @s3_bucket.object(anything).at_least(1) { s3_object }
626
+
627
+ body = {
628
+ "Records" => [
629
+ {
630
+ "s3" => {
631
+ "object" => {
632
+ "key" => "test_key"
633
+ }
634
+ }
635
+ }
636
+ ]
637
+ }
638
+ message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
639
+ @sqs_poller.get_messages(anything, anything) do |config, stats|
640
+ config.before_request.call(stats) if config.before_request
641
+ stats.request_count += 1
642
+ if stats.request_count >= 1
643
+ d.instance.instance_variable_set(:@running, false)
644
+ end
645
+ [message]
646
+ end
647
+ d.run(expect_emits: 1)
648
+ events = d.events
649
+ assert_equal({ "message" => "aaa bbb ccc" }, events.first[2])
650
+ end
651
+
652
+ def test_regexp_not_matching
653
+ setup_mocks
654
+ d = create_driver(CONFIG + "\ncheck_apikey_on_start false\nstore_as text\nformat none\nmatch_regexp live?_key")
655
+
656
+ body = {
657
+ "Records" => [
658
+ {
659
+ "s3" => {
660
+ "object" => {
661
+ "key" => "test_key"
662
+ }
663
+ }
664
+ }
665
+ ]
666
+ }
667
+ message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
668
+ @sqs_poller.get_messages(anything, anything) do |config, stats|
669
+ config.before_request.call(stats) if config.before_request
670
+ stats.request_count += 1
671
+ if stats.request_count >= 1
672
+ d.instance.instance_variable_set(:@running, false)
673
+ end
674
+ [message]
675
+ end
676
+ assert_nothing_raised do
677
+ d.run {}
678
+ end
679
+ end
616
680
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-06-14 00:00:00.000000000 Z
12
+ date: 2022-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd