Class AccessLogFormat
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.apigateway.AccessLogFormat
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T10:47:11.355Z")
@Stability(Stable)
public class AccessLogFormat
extends software.amazon.jsii.JsiiObject
factory methods for access log format.
Example:
Bucket destinationBucket = new Bucket(this, "Bucket");
Role deliveryStreamRole = Role.Builder.create(this, "Role")
.assumedBy(new ServicePrincipal("firehose.amazonaws.com"))
.build();
CfnDeliveryStream stream = CfnDeliveryStream.Builder.create(this, "MyStream")
.deliveryStreamName("amazon-apigateway-delivery-stream")
.s3DestinationConfiguration(S3DestinationConfigurationProperty.builder()
.bucketArn(destinationBucket.getBucketArn())
.roleArn(deliveryStreamRole.getRoleArn())
.build())
.build();
RestApi api = RestApi.Builder.create(this, "books")
.deployOptions(StageOptions.builder()
.accessLogDestination(new FirehoseLogDestination(stream))
.accessLogFormat(AccessLogFormat.jsonWithStandardFields())
.build())
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionAccessLogFormat(String format) protectedAccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedAccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic AccessLogFormatclf()Generate Common Log Format.static AccessLogFormatCustom log format.static AccessLogFormatAccess log will be produced in the JSON format with a set of fields most useful in the access log.static AccessLogFormatAccess log will be produced in the JSON format with a set of fields most useful in the access log.toString()Output a format string to be used with CloudFormation.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
AccessLogFormat
protected AccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef) -
AccessLogFormat
protected AccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
AccessLogFormat
- Parameters:
format- This parameter is required.
-
-
Method Details
-
clf
Generate Common Log Format. -
custom
Custom log 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")))));- Parameters:
format- This parameter is required.
-
jsonWithStandardFields
@Stability(Stable) @NotNull public static AccessLogFormat jsonWithStandardFields(@Nullable JsonWithStandardFieldProps fields) Access log will be produced in the JSON format with a set of fields most useful in the access log.All fields are turned on by default with the option to turn off specific fields.
- Parameters:
fields-
-
jsonWithStandardFields
Access log will be produced in the JSON format with a set of fields most useful in the access log.All fields are turned on by default with the option to turn off specific fields.
-
toString
Output a format string to be used with CloudFormation.
-