I am using AWS Api Gateway and I'd like to trace full request and response. Some of my integrations are lambdas and some other http endpoints.
I enabled stage > Logs > "Log full requests/responses data" and I can see logs on CloudWatch.
This seemed to be perfect until I discovered bodies were being TRUNCATED... There is a limitation of 1024 bytes in ApiGateway sending logs to cloudwatch.
Is there any solution to this?
I am considering using a lambda as a proxy (with http-proxy) as my last option...
Choose the Enable Access Logging check box. For Access Log Destination ARN, enter the ARN of an Amazon Kinesis Data Firehose (this is only supported in REST APIs) or a CloudWatch log group. Enter a Log Format. For guidance, choose CLF, JSON, XML, or CSV to see an example in that format.
As you stated, there is no current known solution to this problem and AWS is aware of the problem.
API Gateway currently limits log events to 1024 bytes. Log events larger than 1024 bytes, such as request and response bodies, will be truncated by API Gateway before submission to CloudWatch Logs.
You can see additional known issues at the AWS documentation page for API Gateway here.
https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html
According to the AWS documentation, full logging should not be turned on in AWS API Gateway, in production, because of PII (source).
This is purely for development troubleshooting purposes. So the log limitation 1024 bytes continue to exists, because of this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With