LogGroupLogDestination

class aws_cdk.aws_apigateway.LogGroupLogDestination(log_group)

Bases: object

Use CloudWatch Logs as a custom access log destination for API Gateway.

ExampleMetadata:

infused

Example:

log_group = logs.LogGroup(self, "ApiGatewayAccessLogs")
apigateway.RestApi(self, "books",
    deploy_options=apigateway.StageOptions(
        access_log_destination=apigateway.LogGroupLogDestination(log_group),
        access_log_format=apigateway.AccessLogFormat.custom(f"""{apigateway.AccessLogField.contextRequestId()} {apigateway.AccessLogField.contextErrorMessage()} {apigateway.AccessLogField.contextErrorMessageString()}
                  {apigateway.AccessLogField.contextAuthorizerError()} {apigateway.AccessLogField.contextAuthorizerIntegrationStatus()}""")
    )
)
Parameters:

log_group (ILogGroup) –

Methods

bind(_stage)

Binds this destination to the CloudWatch Logs.

Parameters:

_stage (IStage) –

Return type:

AccessLogDestinationConfig