Skip to content
v2.274.0

JsonWithStandardFieldProps Struct ​

Properties for controlling items output in JSON standard format.

Example ​

ts
// production stage
const prodLogGroup = new logs.LogGroup(this, "PrdLogs");
const api = new apigateway.RestApi(this, 'books', {
  deployOptions: {
    accessLogDestination: new apigateway.LogGroupLogDestination(prodLogGroup),
    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 ​

callerbooleancallerboolcallerBooleanCallerboolCaller*boolrequired#
If this flag is enabled, the principal identifier of the caller will be output to the log.
httpMethodbooleanhttp_methodboolhttpMethodBooleanHttpMethodboolHttpMethod*boolrequired#
If this flag is enabled, the http method will be output to the log.
ipbooleanipboolipBooleanIpboolIp*boolrequired#
If this flag is enabled, the source IP of request will be output to the log.
protocolbooleanprotocolboolprotocolBooleanProtocolboolProtocol*boolrequired#
If this flag is enabled, the request protocol will be output to the log.
requestTimebooleanrequest_timeboolrequestTimeBooleanRequestTimeboolRequestTime*boolrequired#
If this flag is enabled, the CLF-formatted request time((dd/MMM/yyyy:HH:mm:ss +-hhmm) will be output to the log.
resourcePathbooleanresource_pathboolresourcePathBooleanResourcePathboolResourcePath*boolrequired#
If this flag is enabled, the path to your resource will be output to the log.
responseLengthbooleanresponse_lengthboolresponseLengthBooleanResponseLengthboolResponseLength*boolrequired#
If this flag is enabled, the response payload length will be output to the log.
statusbooleanstatusboolstatusBooleanStatusboolStatus*boolrequired#
If this flag is enabled, the method response status will be output to the log.
userbooleanuserbooluserBooleanUserboolUser*boolrequired#
If this flag is enabled, the principal identifier of the user will be output to the log.