LoggingFormat Class
Configuration for Envoy Access Logging Format for mesh endpoints.
| Source | aws-appmesh/lib/shared-interfaces.ts |
|---|---|
| Type last changed |
Example
ts
declare const mesh: appmesh.Mesh;
declare const service: cloudmap.Service;
const node = new appmesh.VirtualNode(this, 'node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
listeners: [appmesh.VirtualNodeListener.http({
port: 8080,
healthCheck: appmesh.HealthCheck.http({
healthyThreshold: 3,
interval: cdk.Duration.seconds(5),
path: '/ping',
timeout: cdk.Duration.seconds(2),
unhealthyThreshold: 2,
}),
timeout: {
idle: cdk.Duration.seconds(5),
},
})],
backendDefaults: {
tlsClientPolicy: {
validation: {
trust: appmesh.TlsValidationTrust.file('/keys/local_cert_chain.pem'),
},
},
},
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout',
appmesh.LoggingFormat.fromJson(
{testKey1: 'testValue1', testKey2: 'testValue2'})),
});
python
# mesh: appmesh.Mesh
# service: cloudmap.Service
node = appmesh.VirtualNode(self, "node",
mesh=mesh,
service_discovery=appmesh.ServiceDiscovery.cloud_map(service),
listeners=[appmesh.VirtualNodeListener.http(
port=8080,
health_check=appmesh.HealthCheck.http(
healthy_threshold=3,
interval=cdk.Duration.seconds(5),
path="/ping",
timeout=cdk.Duration.seconds(2),
unhealthy_threshold=2
),
timeout=appmesh.HttpTimeout(
idle=cdk.Duration.seconds(5)
)
)],
backend_defaults=appmesh.BackendDefaults(
tls_client_policy=appmesh.TlsClientPolicy(
validation=appmesh.TlsValidation(
trust=appmesh.TlsValidationTrust.file("/keys/local_cert_chain.pem")
)
)
),
access_log=appmesh.AccessLog.from_file_path("/dev/stdout",
appmesh.LoggingFormat.from_json({"test_key1": "testValue1", "test_key2": "testValue2"}))
)
java
Mesh mesh;
Service service;
VirtualNode node = VirtualNode.Builder.create(this, "node")
.mesh(mesh)
.serviceDiscovery(ServiceDiscovery.cloudMap(service))
.listeners(List.of(VirtualNodeListener.http(HttpVirtualNodeListenerOptions.builder()
.port(8080)
.healthCheck(HealthCheck.http(HttpHealthCheckOptions.builder()
.healthyThreshold(3)
.interval(Duration.seconds(5))
.path("/ping")
.timeout(Duration.seconds(2))
.unhealthyThreshold(2)
.build()))
.timeout(HttpTimeout.builder()
.idle(Duration.seconds(5))
.build())
.build())))
.backendDefaults(BackendDefaults.builder()
.tlsClientPolicy(TlsClientPolicy.builder()
.validation(TlsValidation.builder()
.trust(TlsValidationTrust.file("/keys/local_cert_chain.pem"))
.build())
.build())
.build())
.accessLog(AccessLog.fromFilePath("/dev/stdout", LoggingFormat.fromJson(Map.of("testKey1", "testValue1", "testKey2", "testValue2"))))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Mesh mesh;
Service service;
var node = new VirtualNode(this, "node", new VirtualNodeProps {
Mesh = mesh,
ServiceDiscovery = ServiceDiscovery.CloudMap(service),
Listeners = new [] { VirtualNodeListener.Http(new HttpVirtualNodeListenerOptions {
Port = 8080,
HealthCheck = HealthCheck.Http(new HttpHealthCheckOptions {
HealthyThreshold = 3,
Interval = Duration.Seconds(5),
Path = "/ping",
Timeout = Duration.Seconds(2),
UnhealthyThreshold = 2
}),
Timeout = new HttpTimeout {
Idle = Duration.Seconds(5)
}
}) },
BackendDefaults = new BackendDefaults {
TlsClientPolicy = new TlsClientPolicy {
Validation = new TlsValidation {
Trust = TlsValidationTrust.File("/keys/local_cert_chain.pem")
}
}
},
AccessLog = AccessLog.FromFilePath("/dev/stdout", LoggingFormat.FromJson(new Dictionary<string, string> { { "testKey1", "testValue1" }, { "testKey2", "testValue2" } }))
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var mesh Mesh
var service Service
node := appmesh.NewVirtualNode(this, jsii.String("node"), &VirtualNodeProps{
Mesh: Mesh,
ServiceDiscovery: appmesh.ServiceDiscovery_CloudMap(service),
Listeners: []VirtualNodeListener{
appmesh.VirtualNodeListener_Http(&HttpVirtualNodeListenerOptions{
Port: jsii.Number(8080),
HealthCheck: appmesh.HealthCheck_Http(&HttpHealthCheckOptions{
HealthyThreshold: jsii.Number(3),
Interval: cdk.Duration_Seconds(jsii.Number(5)),
Path: jsii.String("/ping"),
Timeout: cdk.Duration_*Seconds(jsii.Number(2)),
UnhealthyThreshold: jsii.Number(2),
}),
Timeout: &HttpTimeout{
Idle: cdk.Duration_*Seconds(jsii.Number(5)),
},
}),
},
BackendDefaults: &BackendDefaults{
TlsClientPolicy: &TlsClientPolicy{
Validation: &TlsValidation{
Trust: appmesh.TlsValidationTrust_File(jsii.String("/keys/local_cert_chain.pem")),
},
},
},
AccessLog: appmesh.AccessLog_FromFilePath(jsii.String("/dev/stdout"), appmesh.LoggingFormat_FromJson(map[string]*string{
"testKey1": jsii.String("testValue1"),
"testKey2": jsii.String("testValue2"),
})),
})
Initializer
ts
new LoggingFormat()
python
LoggingFormat()
java
new LoggingFormat()
csharp
new LoggingFormat()
go
NewLoggingFormat()
Methods
bind(): LoggingFormatConfigdef bind(self, ) -> LoggingFormatConfigpublic LoggingFormatConfig bind()public LoggingFormatConfig Bind()func Bind() LoggingFormatConfig #Called when the Access Log Format is initialized.
Can be used to enforce mutual exclusivity with future properties
fromJson(jsonLoggingFormat: { [key: string]: string }): LoggingFormat // chainable@staticmethod def from_json(json_logging_format: typing.Mapping[str, str]) -> LoggingFormatpublic static LoggingFormat fromJson(Map<String, String> jsonLoggingFormat)public static LoggingFormat FromJson(IDictionary<string, string> jsonLoggingFormat)func FromJson(JsonLoggingFormat *map[string]*string) LoggingFormat static #Generate logging format from json key pairs.
fromText(text: string): LoggingFormat // chainable@staticmethod def from_text(text: str) -> LoggingFormatpublic static LoggingFormat fromText(String text)public static LoggingFormat FromText(string text)func FromText(Text *string) LoggingFormat static #Generate logging format from text pattern.