@Generated(value="jsii-pacmak/1.60.0 (build ebcefe6)",
date="2022-06-22T23:27:59.379Z")
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(java.lang.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.
|
java.lang.String |
toString()
Output a format string to be used with CloudFormation.
|
protected AccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef)
protected AccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public static AccessLogFormat clf()
public static AccessLogFormat custom(java.lang.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.public static AccessLogFormat jsonWithStandardFields(JsonWithStandardFieldProps fields)
All fields are turned on by default with the option to turn off specific fields.
fields
- public static AccessLogFormat jsonWithStandardFields()
All fields are turned on by default with the option to turn off specific fields.
public java.lang.String toString()