Better support for API Gateway execution logs including improved and additional settings
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Enabling execution logs on API Gateway without the full requests/responses being logged now happens through the following 2 properties on the `SpecRestApi`; `deployOptions.loggingLevel: MethodLoggingLevel.INFO` and `deployOptions.dataTraceEnabled: false`. This is somewhat confusing as it isn't clear to the developer that this deals with execution logs. The documentation also does not mention "execution logs" in [the section of this property](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-apigateway.CfnStage.MethodSettingProperty.html#datatraceenabled).
Changing the retention policy of the log group that is created for these execution logs is not possible through CDK, which is possible for access logs. This is a lacking feature and as Cloudwatch logs can be quiet pricy, it is a feature that would be highly beneficial to many.
It would be more convenient if the documentation at least mentions that this is with regards to execution logs or if the property names that are being used are more clear on this.
Having a property such as `accessLogDestination` but for execution logs (eg. `executionLogDestination`) would be highly beneficial as it would allow to modify the retention policy on the log group.
### Use Case
This feature would be useful as it is confusing at the moment on how to enable execution logs. It would be cost saving as well as it is currently impossible to define a retention period for the log group through CDK.
### Proposed Solution
- Update the documentation to include the words "execution logs"
- Change the naming and usage of properties for execution logs
- there could be a property to turn execution logs on
- there could be a property to set the log level (INFO | ERROR)
- there could be a property to set if the full requests/responses need to be logged
- Add a property to pass a custom created log group instead of automatically creating one with the API Gateway deployment
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [X] This feature might incur a breaking change
### CDK version used
2.10.0
### Environment details (OS name and version, etc.)
MacOS Monterey V12.3
Contributor guide
Research direction
Start by reading SpecRestApi deployOptions and the linked MethodSettingProperty documentation, then inspect how accessLogDestination and its log-group retention are handled. Done means the execution-log behavior is clearly documented and the requested execution-log destination or retention configuration has an agreed, tested design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- api, cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100