lib/fluent/plugin/in_cloudwatch_logs.rb in fluent-plugin-cloudwatch-logs-0.9.3 vs lib/fluent/plugin/in_cloudwatch_logs.rb in fluent-plugin-cloudwatch-logs-0.9.4
- old
+ new
@@ -28,10 +28,11 @@
config_param :use_todays_log_stream, :bool, default: false
config_param :use_aws_timestamp, :bool, default: false
config_param :start_time, :string, default: nil
config_param :end_time, :string, default: nil
config_param :time_range_format, :string, default: "%Y-%m-%d %H:%M:%S"
+ config_param :throttling_retry_seconds, :time, default: nil
config_section :parse do
config_set_default :@type, 'none'
end
@@ -181,9 +182,18 @@
if valid_next_token(log_next_token, response.next_forward_token)
store_next_token(response.next_forward_token, log_stream_name)
end
response.events
+ rescue Aws::CloudWatchLogs::Errors::ThrottlingException => err
+ if throttling_retry_seconds
+ log.warn "ThrottlingException in get_log_events (#{log_stream_name}). Waiting #{throttling_retry_seconds} seconds to retry."
+ sleep throttling_retry_seconds
+
+ get_events(log_stream_name)
+ else
+ raise err
+ end
end
def describe_log_streams(log_stream_name_prefix, log_streams = nil, next_token = nil)
request = {
log_group_name: @log_group_name