Cannot enable logging. Policy document length breaking Cloudwatch Logs Constraints, either 1 or > 5120”.

0

When I was trying to enable access logs for my http api in the api gateway, I got an error saying “Cannot enable logging. Policy document length breaking Cloudwatch Logs Constraints, either 1 or > 5120”. On inspecting it through aws logs describe-resource-policies I found the huge policy document. Is there a way to reduce its size?

1개 답변
1
수락된 답변

Hello,

your limitation is described here: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-CWL

These services must list each log group that they're sending logs to in the resource policy, and CloudWatch Logs resource policies are limited to 5120 characters. A service that sends logs to a large number of log groups may run into this limit.

To mitigate this, CloudWatch Logs monitors the size of resource policies used by the service that is sending logs, and when it detects that a policy approaches the size limit of 5120 characters, CloudWatch Logs automatically enables /aws/vendedlogs/* in the resource policy for that service. You can then start using log groups with names that start with /aws/vendedlogs/ as the destinations for logs from these services.

One option is to follow the recommendation and using a log group starting with /aws/vendedlogs as destination. See if that allows you to enable logging.

profile picture
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠