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
If this flag is enabled, the principal identifier of the caller will be output to the log.
If this flag is enabled, the http method will be output to the log.
If this flag is enabled, the source IP of request will be output to the log.
If this flag is enabled, the request protocol will be output to the log.
If this flag is enabled, the CLF-formatted request time((dd/MMM/yyyy:HH:mm:ss +-hhmm) will be output to the log.
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.
If this flag is enabled, the method response status will be output to the log.
If this flag is enabled, the principal identifier of the user will be output to the log.