aws-cdk-lib.aws_apigateway.JsonWithStandardFieldProps

interface JsonWithStandardFieldProps

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.JsonWithStandardFieldProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#JsonWithStandardFieldProps
Javasoftware.amazon.awscdk.services.apigateway.JsonWithStandardFieldProps
Pythonaws_cdk.aws_apigateway.JsonWithStandardFieldProps
TypeScript (source)aws-cdk-lib » aws_apigateway » JsonWithStandardFieldProps

Properties for controlling items output in JSON standard format.

Example

// production stage
const prdLogGroup = new logs.LogGroup(this, "PrdLogs");
const api = new apigateway.RestApi(this, 'books', {
  deployOptions: {
    accessLogDestination: new apigateway.LogGroupLogDestination(prdLogGroup),
    accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields(),
  },
});
const deployment = new apigateway.Deployment(this, 'Deployment', {api});

// development stage
const devLogGroup = new logs.LogGroup(this, "DevLogs");
new apigateway.Stage(this, 'dev', {
  deployment,
  accessLogDestination: new apigateway.LogGroupLogDestination(devLogGroup),
  accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields({
    caller: false,
    httpMethod: true,
    ip: true,
    protocol: true,
    requestTime: true,
    resourcePath: true,
    responseLength: true,
    status: true,
    user: true,
  }),
});

Properties

NameTypeDescription
callerbooleanIf this flag is enabled, the principal identifier of the caller will be output to the log.
httpMethodbooleanIf this flag is enabled, the http method will be output to the log.
ipbooleanIf this flag is enabled, the source IP of request will be output to the log.
protocolbooleanIf this flag is enabled, the request protocol will be output to the log.
requestTimebooleanIf this flag is enabled, the CLF-formatted request time((dd/MMM/yyyy:HH:mm:ss +-hhmm) will be output to the log.
resourcePathbooleanIf this flag is enabled, the path to your resource will be output to the log.
responseLengthbooleanIf this flag is enabled, the response payload length will be output to the log.
statusbooleanIf this flag is enabled, the method response status will be output to the log.
userbooleanIf this flag is enabled, the principal identifier of the user will be output to the log.

caller

Type: boolean

If this flag is enabled, the principal identifier of the caller will be output to the log.


httpMethod

Type: boolean

If this flag is enabled, the http method will be output to the log.


ip

Type: boolean

If this flag is enabled, the source IP of request will be output to the log.


protocol

Type: boolean

If this flag is enabled, the request protocol will be output to the log.


requestTime

Type: boolean

If this flag is enabled, the CLF-formatted request time((dd/MMM/yyyy:HH:mm:ss +-hhmm) will be output to the log.


resourcePath

Type: boolean

If this flag is enabled, the path to your resource will be output to the log.


responseLength

Type: boolean

If this flag is enabled, the response payload length will be output to the log.


status

Type: boolean

If this flag is enabled, the method response status will be output to the log.


user

Type: boolean

If this flag is enabled, the principal identifier of the user will be output to the log.