@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:36.081Z") @Stability(value=Stable) public class AccessLogFormat extends software.amazon.jsii.JsiiObject
Example:
LogGroup logGroup = new LogGroup(this, "ApiGatewayAccessLogs");
RestApi.Builder.create(this, "books")
.deployOptions(StageOptions.builder()
.accessLogDestination(new LogGroupLogDestination(logGroup))
.accessLogFormat(AccessLogFormat.custom(String.format("%s %s %s", AccessLogField.contextRequestId(), AccessLogField.contextErrorMessage(), AccessLogField.contextErrorMessageString())))
.build())
.build();
| Modifier | Constructor and Description |
|---|---|
protected |
AccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
AccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static AccessLogFormat |
clf()
Generate Common Log Format.
|
static AccessLogFormat |
custom(String format)
Custom log format.
|
static AccessLogFormat |
jsonWithStandardFields()
Access log will be produced in the JSON format with a set of fields most useful in the access log.
|
static AccessLogFormat |
jsonWithStandardFields(JsonWithStandardFieldProps fields)
Access log will be produced in the JSON format with a set of fields most useful in the access log.
|
String |
toString()
Output a format string to be used with CloudFormation.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected AccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef)
protected AccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) @NotNull public static AccessLogFormat clf()
@Stability(value=Stable) @NotNull public static AccessLogFormat custom(@NotNull String format)
You can create any log format string. You can easily get the $ context variable by using the methods of AccessLogField.
Example:
AccessLogFormat.custom(JSON.stringify(Map.of(
"requestId", AccessLogField.contextRequestId(),
"sourceIp", AccessLogField.contextIdentitySourceIp(),
"method", AccessLogField.contextHttpMethod(),
"userContext", Map.of(
"sub", AccessLogField.contextAuthorizerClaims("sub"),
"email", AccessLogField.contextAuthorizerClaims("email")))));
format - This parameter is required.@Stability(value=Stable) @NotNull public static AccessLogFormat jsonWithStandardFields(@Nullable JsonWithStandardFieldProps fields)
All fields are turned on by default with the option to turn off specific fields.
fields - @Stability(value=Stable) @NotNull public static AccessLogFormat jsonWithStandardFields()
All fields are turned on by default with the option to turn off specific fields.
Copyright © 2022. All rights reserved.