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.84.0 (build 5404dcf)", date="2023-06-19T16:30:44.686Z") @Stability(Stable) public class AccessLogFormat extends software.amazon.jsii.JsiiObject
factory methods for access log format.

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();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    AccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    clf()
    Generate Common Log Format.
    custom(String format)
    Custom log format.
    Access log will be produced in the JSON format with a set of fields most useful in the access log.
    Access log will be produced in the JSON format with a set of fields most useful in the access log.
    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, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods 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)
  • Method Details

    • clf

      @Stability(Stable) @NotNull public static AccessLogFormat clf()
      Generate Common Log Format.
    • custom

      @Stability(Stable) @NotNull public static AccessLogFormat custom(@NotNull String format)
      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

      @Stability(Stable) @NotNull public static AccessLogFormat 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

      @Stability(Stable) @NotNull public String toString()
      Output a format string to be used with CloudFormation.
      Overrides:
      toString in class Object