fluent-plugins-nursery / fluent-plugin-cloudwatch-logs

CloudWatch Logs Plugin for Fluentd
MIT License
201 stars 141 forks source link

Excessive throttling when using some AWS services #246

Open atanunq opened 2 years ago

atanunq commented 2 years ago

First of all, thank you for the very useful plugin!

Problem

Using in_cloudwatch_logs, we are ingesting logs from a few different AWS services, most notably Lambda and AppSync:

# AppSync config
...
log_group_name            /aws/appsync/apis/
use_log_group_name_prefix true

# Lambda config
...
log_group_name            /aws/lambda/
use_log_group_name_prefix true
use_todays_log_stream     true # Get only log streams prefixed with today's YYYY/MM/DD

However, both of these services create a log stream for each request, which results in having a lot streams with few logs lines in each (even with very short retention configured). With the current configuration, get_log_events API calls are made for each stream, even though no new log lines are expected for older streams. After a while, the get_log_events quota is reached and throttling comes into play.

To mitigate that, I've been thinking about a few different approaches:

I am happy to work towards a solution, if any of that makes sense