ServiceConnectAccessLogFormat Enum
The format of Service Connect access logs.
Example
ts
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
const service = new ecs.FargateService(this, 'Service', {
cluster,
taskDefinition,
serviceConnectConfiguration: {
services: [
{
portMappingName: 'api',
},
],
accessLogConfiguration: {
format: ecs.ServiceConnectAccessLogFormat.JSON,
includeQueryParameters: true,
},
// When configuring access log,
// you also need to configure the log driver accordingly.
logDriver: ecs.LogDrivers.awsLogs({
streamPrefix: 'prefix',
}),
},
});
python
# cluster: ecs.Cluster
# task_definition: ecs.TaskDefinition
service = ecs.FargateService(self, "Service",
cluster=cluster,
task_definition=task_definition,
service_connect_configuration=ecs.ServiceConnectProps(
services=[ecs.ServiceConnectService(
port_mapping_name="api"
)
],
access_log_configuration=ecs.ServiceConnectAccessLogConfiguration(
format=ecs.ServiceConnectAccessLogFormat.JSON,
include_query_parameters=True
),
# When configuring access log,
# you also need to configure the log driver accordingly.
log_driver=ecs.LogDrivers.aws_logs(
stream_prefix="prefix"
)
)
)
java
Cluster cluster;
TaskDefinition taskDefinition;
FargateService service = FargateService.Builder.create(this, "Service")
.cluster(cluster)
.taskDefinition(taskDefinition)
.serviceConnectConfiguration(ServiceConnectProps.builder()
.services(List.of(ServiceConnectService.builder()
.portMappingName("api")
.build()))
.accessLogConfiguration(ServiceConnectAccessLogConfiguration.builder()
.format(ServiceConnectAccessLogFormat.JSON)
.includeQueryParameters(true)
.build())
// When configuring access log,
// you also need to configure the log driver accordingly.
.logDriver(LogDrivers.awsLogs(AwsLogDriverProps.builder()
.streamPrefix("prefix")
.build()))
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Cluster cluster;
TaskDefinition taskDefinition;
var service = new FargateService(this, "Service", new FargateServiceProps {
Cluster = cluster,
TaskDefinition = taskDefinition,
ServiceConnectConfiguration = new ServiceConnectProps {
Services = new [] { new ServiceConnectService {
PortMappingName = "api"
} },
AccessLogConfiguration = new ServiceConnectAccessLogConfiguration {
Format = ServiceConnectAccessLogFormat.JSON,
IncludeQueryParameters = true
},
// When configuring access log,
// you also need to configure the log driver accordingly.
LogDriver = LogDrivers.AwsLogs(new AwsLogDriverProps {
StreamPrefix = "prefix"
})
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var cluster Cluster
var taskDefinition TaskDefinition
service := ecs.NewFargateService(this, jsii.String("Service"), &FargateServiceProps{
Cluster: Cluster,
TaskDefinition: TaskDefinition,
ServiceConnectConfiguration: &ServiceConnectProps{
Services: []ServiceConnectService{
&ServiceConnectService{
PortMappingName: jsii.String("api"),
},
},
AccessLogConfiguration: &ServiceConnectAccessLogConfiguration{
Format: ecs.ServiceConnectAccessLogFormat_JSON,
IncludeQueryParameters: jsii.Boolean(true),
},
// When configuring access log,
// you also need to configure the log driver accordingly.
LogDriver: ecs.LogDrivers_AwsLogs(&AwsLogDriverProps{
StreamPrefix: jsii.String("prefix"),
}),
},
})
Members
| Member | Description |
|---|---|
TEXT | Human-readable text format for access logs. |
JSON | Structured JSON format for access logs. |
Referenced by
ServiceConnectAccessLogConfiguration.formatformatformatFormatFormat