lib/fluent/plugin/in_cloudwatch_logs.rb in fluent-plugin-cloudwatch-logs-0.7.0 vs lib/fluent/plugin/in_cloudwatch_logs.rb in fluent-plugin-cloudwatch-logs-0.7.1
- old
+ new
@@ -107,17 +107,22 @@
if Time.now > @next_fetch_time
@next_fetch_time += @fetch_interval
if @use_log_stream_name_prefix || @use_todays_log_stream
log_stream_name_prefix = @use_todays_log_stream ? get_todays_date : @log_stream_name
- log_streams = describe_log_streams(log_stream_name_prefix)
- log_streams.concat(describe_log_streams(get_yesterdays_date)) if @use_todays_log_stream
- log_streams.each do |log_stream|
- log_stream_name = log_stream.log_stream_name
- events = get_events(log_stream_name)
- events.each do |event|
- emit(log_stream_name, event)
+ begin
+ log_streams = describe_log_streams(log_stream_name_prefix)
+ log_streams.concat(describe_log_streams(get_yesterdays_date)) if @use_todays_log_stream
+ log_streams.each do |log_stream|
+ log_stream_name = log_stream.log_stream_name
+ events = get_events(log_stream_name)
+ events.each do |event|
+ emit(log_stream_name, event)
+ end
end
+ rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException
+ log.warn "'#{@log_stream_name}' prefixed log stream(s) are not found"
+ next
end
else
events = get_events(@log_stream_name)
events.each do |event|
emit(log_stream_name, event)