# LoggingOptions

Configures log settings for the domain.

- Source: [`aws-elasticsearch/lib/domain.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-elasticsearch/lib/domain.ts#L298)
- Type last changed: v2.235.0 · 15 Jan 2026

## Example

TypeScript:

```ts
const prodDomain = new es.Domain(this, 'Domain', {
  version: es.ElasticsearchVersion.V7_1,
  capacity: {
    masterNodes: 5,
    dataNodes: 20,
  },
  ebs: {
    volumeSize: 20,
  },
  zoneAwareness: {
    availabilityZoneCount: 3,
  },
  logging: {
    slowSearchLogEnabled: true,
    appLogEnabled: true,
    slowIndexLogEnabled: true,
  },
});
```

Python:

```python
prod_domain = es.Domain(self, "Domain",
    version=es.ElasticsearchVersion.V7_1,
    capacity=es.CapacityConfig(
        master_nodes=5,
        data_nodes=20
    ),
    ebs=es.EbsOptions(
        volume_size=20
    ),
    zone_awareness=es.ZoneAwarenessConfig(
        availability_zone_count=3
    ),
    logging=es.LoggingOptions(
        slow_search_log_enabled=True,
        app_log_enabled=True,
        slow_index_log_enabled=True
    )
)
```

Java:

```java
Domain prodDomain = Domain.Builder.create(this, "Domain")
        .version(ElasticsearchVersion.V7_1)
        .capacity(CapacityConfig.builder()
                .masterNodes(5)
                .dataNodes(20)
                .build())
        .ebs(EbsOptions.builder()
                .volumeSize(20)
                .build())
        .zoneAwareness(ZoneAwarenessConfig.builder()
                .availabilityZoneCount(3)
                .build())
        .logging(LoggingOptions.builder()
                .slowSearchLogEnabled(true)
                .appLogEnabled(true)
                .slowIndexLogEnabled(true)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var prodDomain = new Domain(this, "Domain", new DomainProps {
    Version = ElasticsearchVersion.V7_1,
    Capacity = new CapacityConfig {
        MasterNodes = 5,
        DataNodes = 20
    },
    Ebs = new EbsOptions {
        VolumeSize = 20
    },
    ZoneAwareness = new ZoneAwarenessConfig {
        AvailabilityZoneCount = 3
    },
    Logging = new LoggingOptions {
        SlowSearchLogEnabled = true,
        AppLogEnabled = true,
        SlowIndexLogEnabled = true
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
prodDomain := es.NewDomain(this, jsii.String("Domain"), &DomainProps{
	Version: es.ElasticsearchVersion_V7_1(),
	Capacity: &CapacityConfig{
		MasterNodes: jsii.Number(5),
		DataNodes: jsii.Number(20),
	},
	Ebs: &EbsOptions{
		VolumeSize: jsii.Number(20),
	},
	ZoneAwareness: &ZoneAwarenessConfig{
		AvailabilityZoneCount: jsii.Number(3),
	},
	Logging: &LoggingOptions{
		SlowSearchLogEnabled: jsii.Boolean(true),
		AppLogEnabled: jsii.Boolean(true),
		SlowIndexLogEnabled: jsii.Boolean(true),
	},
})
```

## Properties

- `appLogEnabled`: boolean = false — use opensearchservice module instead

  Requires Elasticsearch version 5.1 or later.

- `appLogGroup`: [ILogGroupRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_logs.ILogGroupRef.html) — use opensearchservice module instead

  **Default:** a new log group is created if app logging is enabled

- `auditLogEnabled`: boolean = false — use opensearchservice module instead

  Requires Elasticsearch version 6.7 or later and fine grained access control to be enabled.

- `auditLogGroup`: [ILogGroupRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_logs.ILogGroupRef.html) — use opensearchservice module instead

  **Default:** a new log group is created if audit logging is enabled

- `slowIndexLogEnabled`: boolean = false — use opensearchservice module instead

  Requires Elasticsearch version 5.1 or later.

- `slowIndexLogGroup`: [ILogGroupRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_logs.ILogGroupRef.html) — use opensearchservice module instead

  **Default:** a new log group is created if slow index logging is enabled

- `slowSearchLogEnabled`: boolean = false — use opensearchservice module instead

  Requires Elasticsearch version 5.1 or later.

- `slowSearchLogGroup`: [ILogGroupRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_logs.ILogGroupRef.html) — use opensearchservice module instead

  **Default:** a new log group is created if slow search logging is enabled
