# LogGroupLogDestination

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

Implements: [IAccessLogDestination](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IAccessLogDestination.html)

- Source: [`aws-apigatewayv2/lib/common/access-log.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/common/access-log.ts#L27)
- Type last changed: v2.235.0 · 15 Jan 2026

## Example

TypeScript:

```ts
import * as apigw from 'aws-cdk-lib/aws-apigateway';
import * as logs from 'aws-cdk-lib/aws-logs';

declare const api: apigwv2.HttpApi;
declare const logGroup: logs.LogGroup;

const stage = new apigwv2.HttpStage(this, 'Stage', {
  httpApi: api,
  accessLogSettings: {
    destination: new apigwv2.LogGroupLogDestination(logGroup),
    format: apigw.AccessLogFormat.clf(),
  },
});
```

Python:

```python
import aws_cdk.aws_apigateway as apigw
import aws_cdk.aws_logs as logs

# api: apigwv2.HttpApi
# log_group: logs.LogGroup

stage = apigwv2.HttpStage(self, "Stage",
    http_api=api,
    access_log_settings={
        "destination": apigwv2.LogGroupLogDestination(log_group),
        "format": apigw.AccessLogFormat.clf()
    }
)
```

Java:

```java
import software.amazon.awscdk.services.apigateway.*;
import software.amazon.awscdk.services.logs.*;

HttpApi api;
LogGroup logGroup;

HttpStage stage = HttpStage.Builder.create(this, "Stage")
        .httpApi(api)
        .accessLogSettings(Map.of(
                "destination", new LogGroupLogDestination(logGroup),
                "format", AccessLogFormat.clf()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.APIGateway;
using Amazon.CDK.AWS.Logs;

HttpApi api;
LogGroup logGroup;

var stage = new HttpStage(this, "Stage", new HttpStageProps {
    HttpApi = api,
    AccessLogSettings = new Dictionary<string, object> {
        { "destination", new LogGroupLogDestination(logGroup) },
        { "format", AccessLogFormat.Clf() }
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import apigw "github.com/aws/aws-cdk-go/awscdk"
import logs "github.com/aws/aws-cdk-go/awscdk"

var api HttpApi
var logGroup LogGroup

stage := apigwv2.NewHttpStage(this, jsii.String("Stage"), &HttpStageProps{
	HttpApi: api,
	AccessLogSettings: map[string]interface{}{
		"destination": apigwv2.NewLogGroupLogDestination(logGroup),
		"format": apigw.AccessLogFormat_clf(),
	},
})
```

## Initializer

TypeScript:

```ts
new LogGroupLogDestination(logGroup: ILogGroupRef)
```

Python:

```python
LogGroupLogDestination(log_group: ILogGroupRef)
```

Java:

```java
new LogGroupLogDestination(ILogGroupRef logGroup)
```

C# / .NET:

```csharp
new LogGroupLogDestination(ILogGroupRef logGroup)
```

Golang:

```go
NewLogGroupLogDestination(LogGroup ILogGroupRef)
```

## Methods

- `bind(_stage: IStage): AccessLogDestinationConfig` — Binds this destination to the CloudWatch Logs.
