New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for API Gateway REST API Logs #6057
Conversation
926bec8
to
3b5b5ef
Compare
Cool to see native integration of API GW logs are coming soon! Great work. Should we expect options to customize the format logging afterwards as well? https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html & https://docs.aws.amazon.com/apigateway/api-reference/resource/stage/#format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM & worked as expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. wrong button. approved!
Thanks @dschep 👍 @drissamri yes, that's a good idea. The initial implementation was planned to be as simple as possible but we can extend this easily later on. |
@pmuens is there already a ticket on your backlog to update the implementation to support custom logging? |
@pmuens please expose the following fields for configuration of the log group and log format
Here's our current serverless.yml that we use to create the log group and set retention time as well as the custom format:
|
@anjo-swe no, we haven't created such an issue. Feel free to open one! 👍 @gootdude thanks for the feedback. That sounds reasonable. With this iteration we want to implement the most simple way to enable API Gateway logs. Well built upon this implementation in the upcoming versions. Feel free to add your requirements to the API Gateway logs issue (the one @anjo-swe will create). Thanks again for looking into this and providing feedback 🙏 |
When can we expect to see this feature released and is there any way we can use this feature in the meantime? Many thanks |
@davidfarinha We've just release the new Serverless Framework version which adds support for this. Should hit the CDNs in a couple of minutes ⏲ |
Very nice, great work! |
I'm using the following serverless config with version 1.42.1 apiGateway:
logs: true
apiKeySourceType: HEADER
minimumCompressionSize: 1024 And even tried re-deploying however still not getting any logs configured on my API Gateway or can't see any log streams created in CloudWatch. Any ideas? |
@davidfarinha checking history I found out this feature was changed a bit before a release - 1df8598#diff-7ef39ede04c5da8e81c20fe60e80a9ce Now, format for logs is:
and it works for me |
Thanks @sdomagala, works for me now. |
Any one tested the feature to true first, then to false? I enable access log with |
After enabled the access log, I got the error sometime (2 times), after deploy the change.
I have to manually delete the log group to fix this issue, but that's not right. I will lost old access logs. |
Facing same issue as @ozbillwang , first deployment is fine, second one throws
any workaround? |
This is happening to us too. Furthermore, if you set logging to true you get this error on second deploy. If you NOT set logging to anything - it unsets the existing logging settings and stops ALL logging for the API. (See: #6165) This is pretty bad. |
I do recommend to rollback this change now and redo it later |
Where is this feature documented? |
What did you implement:
Adds native support for API Gateway logs via the API Gateway stage resource.
Closes #4461
How did you implement it:
Merge in all the resources necessary to setup API Gateway logging via CloudFormation. Set the correct settings in the API Gateway Stage resource.
How can we verify it:
Deploy the following
serverless.yml
:After that
curl
the endpoint and look into CloudWatch logs for theapi-gateway
log group.Todos:
Is this ready for review?: YES
Is it a breaking change?: NO