fluent-plugin-gcs 0.4.1 → 0.4.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/.github/workflows/test.yaml +24 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +10 -1
- data/README.md +1 -1
- data/fluent-plugin-gcs.gemspec +0 -6
- data/lib/fluent/plugin/gcs/version.rb +1 -1
- data/lib/fluent/plugin/out_gcs.rb +27 -15
- metadata +7 -77
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06b8bb5edbdcbf288abdadf04670aba1ce83ce1e9f1f8d2ccfae29c543a6b87e
|
4
|
+
data.tar.gz: 2678dbe5a7bdd06149be0cd8bd4bfb0b65557b842c58790b0db7680ba4f58d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67857cecbfc047d0f8e2dbbf0cf3065a3f0b0a11ce08bf277574060f0238648ef36ca4f5d8f498af4a30632a13d81112cc0ae9a55846bb7aaf3703260df07260
|
7
|
+
data.tar.gz: ae8f1b545dc3b89f8209597addff218ec713040970ab3bdc4dd4db35acf4482927d9f41ccad3a90bc8c9eb0a66d20ba3116d3c06839772669181350d54dd266c
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby-version: ['3.1', '3.2']
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v4
|
18
|
+
- name: Set up Ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
bundler-cache: true
|
23
|
+
- name: Run tests
|
24
|
+
run: bundle exec rake test
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in fluent-plugin-gcs.gemspec
|
4
6
|
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
gem "rr", "= 1.1.2"
|
10
|
+
gem "test-unit", ">= 3.0.8"
|
11
|
+
gem "test-unit-rr", ">= 1.0.3"
|
12
|
+
gem "timecop"
|
13
|
+
gem "solargraph"
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# fluent-plugin-gcs
|
2
|
-
[](https://badge.fury.io/rb/fluent-plugin-gcs) [](https://badge.fury.io/rb/fluent-plugin-gcs) [](https://github.com/daichirata/fluent-plugin-gcs/actions/workflows/test.yaml) [](https://codeclimate.com/github/daichirata/fluent-plugin-gcs)
|
3
3
|
|
4
4
|
Google Cloud Storage output plugin for [Fluentd](https://github.com/fluent/fluentd).
|
5
5
|
|
data/fluent-plugin-gcs.gemspec
CHANGED
@@ -22,10 +22,4 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_runtime_dependency "fluentd", [">= 0.14.22", "< 2"]
|
24
24
|
spec.add_runtime_dependency "google-cloud-storage", "~> 1.1"
|
25
|
-
|
26
|
-
spec.add_development_dependency "rake", ">= 12.3.3"
|
27
|
-
spec.add_development_dependency "rr", "= 1.1.2"
|
28
|
-
spec.add_development_dependency "test-unit", ">= 3.0.8"
|
29
|
-
spec.add_development_dependency "test-unit-rr", ">= 1.0.3"
|
30
|
-
spec.add_development_dependency "timecop"
|
31
25
|
end
|
@@ -15,6 +15,7 @@ module Fluent::Plugin
|
|
15
15
|
def initialize
|
16
16
|
super
|
17
17
|
require "google/cloud/storage"
|
18
|
+
Google::Apis.logger = log
|
18
19
|
end
|
19
20
|
|
20
21
|
config_param :project, :string, default: nil,
|
@@ -131,7 +132,7 @@ module Fluent::Plugin
|
|
131
132
|
opts.merge!(@encryption_opts)
|
132
133
|
|
133
134
|
log.debug { "out_gcs: upload chunk:#{chunk.key} to gcs://#{@bucket}/#{path} options: #{opts}" }
|
134
|
-
@gcs_bucket.upload_file(obj.path, path, opts)
|
135
|
+
@gcs_bucket.upload_file(obj.path, path, **opts)
|
135
136
|
end
|
136
137
|
end
|
137
138
|
|
@@ -153,13 +154,13 @@ module Fluent::Plugin
|
|
153
154
|
|
154
155
|
def check_object_exists(path)
|
155
156
|
if !@blind_write
|
156
|
-
return @gcs_bucket.find_file(path,
|
157
|
+
return @gcs_bucket.find_file(path, **@encryption_opts)
|
157
158
|
else
|
158
159
|
return false
|
159
160
|
end
|
160
161
|
end
|
161
162
|
|
162
|
-
def generate_path(chunk
|
163
|
+
def generate_path(chunk)
|
163
164
|
metadata = chunk.metadata
|
164
165
|
time_slice = if metadata.timekey.nil?
|
165
166
|
''.freeze
|
@@ -170,23 +171,34 @@ module Fluent::Plugin
|
|
170
171
|
"%{file_extension}" => @object_creator.file_extension,
|
171
172
|
"%{hex_random}" => hex_random(chunk),
|
172
173
|
"%{hostname}" => Socket.gethostname,
|
173
|
-
"%{index}" => i,
|
174
174
|
"%{path}" => @path,
|
175
175
|
"%{time_slice}" => time_slice,
|
176
|
-
"%{uuid_flush}" => SecureRandom.uuid,
|
177
176
|
}
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
177
|
+
|
178
|
+
prev = nil
|
179
|
+
i = 0
|
180
|
+
|
181
|
+
until i < 0 do # Until overflow
|
182
|
+
tags["%{uuid_flush}"] = SecureRandom.uuid
|
183
|
+
tags["%{index}"] = i
|
184
|
+
|
185
|
+
path = @object_key_format.gsub(Regexp.union(tags.keys), tags)
|
186
|
+
path = extract_placeholders(path, chunk)
|
187
|
+
return path unless check_object_exists(path)
|
188
|
+
|
189
|
+
if path == prev
|
190
|
+
if @overwrite
|
191
|
+
log.warn "object `#{path}` already exists but overwrites it"
|
192
|
+
return path
|
193
|
+
end
|
194
|
+
raise "object `#{path}` already exists"
|
186
195
|
end
|
187
|
-
|
196
|
+
|
197
|
+
i += 1
|
198
|
+
prev = path
|
188
199
|
end
|
189
|
-
|
200
|
+
|
201
|
+
raise "cannot find an unoccupied GCS path"
|
190
202
|
end
|
191
203
|
|
192
204
|
# This is stolen from Fluentd
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daichi HIRATA
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -44,76 +44,6 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.1'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rake
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 12.3.3
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 12.3.3
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: rr
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - '='
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 1.1.2
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - '='
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 1.1.2
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: test-unit
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: 3.0.8
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 3.0.8
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: test-unit-rr
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 1.0.3
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 1.0.3
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: timecop
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
47
|
description: Google Cloud Storage output plugin for Fluentd
|
118
48
|
email:
|
119
49
|
- hirata.daichi@gmail.com
|
@@ -121,8 +51,8 @@ executables: []
|
|
121
51
|
extensions: []
|
122
52
|
extra_rdoc_files: []
|
123
53
|
files:
|
54
|
+
- ".github/workflows/test.yaml"
|
124
55
|
- ".gitignore"
|
125
|
-
- ".travis.yml"
|
126
56
|
- CHANGELOG.md
|
127
57
|
- Gemfile
|
128
58
|
- LICENSE.txt
|
@@ -138,7 +68,7 @@ homepage: https://github.com/daichirata/fluent-plugin-gcs
|
|
138
68
|
licenses:
|
139
69
|
- Apache-2.0
|
140
70
|
metadata: {}
|
141
|
-
post_install_message:
|
71
|
+
post_install_message:
|
142
72
|
rdoc_options: []
|
143
73
|
require_paths:
|
144
74
|
- lib
|
@@ -153,8 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
83
|
- !ruby/object:Gem::Version
|
154
84
|
version: '0'
|
155
85
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
157
|
-
signing_key:
|
86
|
+
rubygems_version: 3.3.7
|
87
|
+
signing_key:
|
158
88
|
specification_version: 4
|
159
89
|
summary: Google Cloud Storage output plugin for Fluentd
|
160
90
|
test_files: []
|