Class: Fluent::Plugin::S3Input
- Inherits:
-
Input
- Object
- Input
- Fluent::Plugin::S3Input
show all
- Defined in:
- lib/fluent/plugin/in_s3.rb,
lib/fluent/plugin/s3_extractor_lzo.rb,
lib/fluent/plugin/s3_extractor_lzma2.rb,
lib/fluent/plugin/s3_extractor_gzip_command.rb
Defined Under Namespace
Classes: Extractor, GzipCommandExtractor, GzipExtractor, JsonExtractor, LZMA2Extractor, LZOExtractor, TextExtractor
Constant Summary
collapse
- DEFAULT_PARSE_TYPE =
"none"
- UNRECOVERABLE_ERRORS =
[
Fluent::UnrecoverableError,
TypeError,
ArgumentError,
EncodingError,
JSON::ParserError,
MessagePack::UnpackError,
Zlib::Error,
].freeze
- DECOMPRESSION_SIZE_LIMIT =
256 * 1024 * 1024
- LOG_MAX_BYTES =
256
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of S3Input.
21
22
23
24
|
# File 'lib/fluent/plugin/in_s3.rb', line 21
def initialize
super
= nil
end
|
Instance Attribute Details
#bucket ⇒ Object
Returns the value of attribute bucket.
144
145
146
|
# File 'lib/fluent/plugin/in_s3.rb', line 144
def bucket
@bucket
end
|
Class Method Details
566
567
568
|
# File 'lib/fluent/plugin/in_s3.rb', line 566
def self.(name, )
.register(name, )
end
|
Instance Method Details
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/fluent/plugin/in_s3.rb', line 151
def configure(conf)
super
if reject_s3_endpoint?
raise Fluent::ConfigError, "s3_endpoint parameter is not supported for S3, use s3_region instead. This parameter is for S3 compatible services"
end
if @sqs.endpoint && (@sqs.endpoint.end_with?('amazonaws.com') && !['fips', 'gov'].any? { |e| @sqs.endpoint.include?(e) })
raise Fluent::ConfigError, "sqs/endpoint parameter is not supported for SQS, use s3_region instead. This parameter is for SQS compatible services"
end
parser_config = conf.elements("parse").first
unless @sqs.queue_name
raise Fluent::ConfigError, "sqs/queue_name is required"
end
if !!@aws_key_id ^ !!@aws_sec_key
raise Fluent::ConfigError, "aws_key_id or aws_sec_key is missing"
end
if !!@sqs.aws_key_id ^ !!@sqs.aws_sec_key
raise Fluent::ConfigError, "sqs/aws_key_id or sqs/aws_sec_key is missing"
end
Aws.use_bundled_cert! if @use_bundled_cert
= .lookup(@store_as).new(log: log, decompression_size_limit: @decompression_size_limit)
.configure(conf)
@parser = parser_create(conf: parser_config, default_type: DEFAULT_PARSE_TYPE)
end
|
#multi_workers_ready? ⇒ Boolean
183
184
185
|
# File 'lib/fluent/plugin/in_s3.rb', line 183
def multi_workers_ready?
true
end
|
#reject_s3_endpoint? ⇒ Boolean
146
147
148
149
|
# File 'lib/fluent/plugin/in_s3.rb', line 146
def reject_s3_endpoint?
@s3_endpoint && !@s3_endpoint.end_with?('vpce.amazonaws.com') &&
@s3_endpoint.end_with?('amazonaws.com') && !['fips', 'gov'].any? { |e| @s3_endpoint.include?(e) }
end
|
#shutdown ⇒ Object
211
212
213
214
|
# File 'lib/fluent/plugin/in_s3.rb', line 211
def shutdown
@running = false
super
end
|
#start ⇒ Object
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# File 'lib/fluent/plugin/in_s3.rb', line 187
def start
super
s3_client = create_s3_client
log.debug("Succeeded to create S3 client")
@s3 = Aws::S3::Resource.new(client: s3_client)
@bucket = @s3.bucket(@s3_bucket)
raise "#{@bucket.name} is not found." unless @bucket.exists?
check_apikeys if @check_apikey_on_start
sqs_client = create_sqs_client
log.debug("Succeeded to create SQS client")
response = sqs_client.get_queue_url(queue_name: @sqs.queue_name, queue_owner_aws_account_id: @sqs.queue_owner_aws_account_id)
sqs_queue_url = response.queue_url
log.debug("Succeeded to get SQS queue URL")
@poller = Aws::SQS::QueuePoller.new(sqs_queue_url, client: sqs_client)
@running = true
thread_create(:in_s3, &method(:run))
end
|