Table of Contents

Class LogGroupLogDestination

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll

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

public class LogGroupLogDestination : DeputyBase, IAccessLogDestination
Inheritance
LogGroupLogDestination
Implements

Examples

var logGroup = new LogGroup(this, "ApiGatewayAccessLogs");
            new RestApi(this, "books", new RestApiProps {
                DeployOptions = new StageOptions {
                    AccessLogDestination = new LogGroupLogDestination(logGroup),
                    AccessLogFormat = AccessLogFormat.Custom($"{apigateway.AccessLogField.contextRequestId()} {apigateway.AccessLogField.contextErrorMessage()} {apigateway.AccessLogField.contextErrorMessageString()}")
                }
            });

Remarks

ExampleMetadata: infused

Constructors

LogGroupLogDestination(ILogGroup)

public LogGroupLogDestination(ILogGroup logGroup)

Parameters

logGroup ILogGroup

Methods

Bind(IStage)

Binds this destination to the CloudWatch Logs.

public virtual IAccessLogDestinationConfig Bind(IStage stage)

Parameters

stage IStage

Returns

IAccessLogDestinationConfig