JsonWithStandardFieldProps

class aws_cdk.aws_apigateway.JsonWithStandardFieldProps(*, caller, http_method, ip, protocol, request_time, resource_path, response_length, status, user)

Bases: object

Properties for controlling items output in JSON standard format.

Parameters:
  • caller (bool) – If this flag is enabled, the principal identifier of the caller will be output to the log.

  • http_method (bool) – If this flag is enabled, the http method will be output to the log.

  • ip (bool) – If this flag is enabled, the source IP of request will be output to the log.

  • protocol (bool) – If this flag is enabled, the request protocol will be output to the log.

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

  • resource_path (bool) – If this flag is enabled, the path to your resource will be output to the log.

  • response_length (bool) – If this flag is enabled, the response payload length will be output to the log.

  • status (bool) – If this flag is enabled, the method response status will be output to the log.

  • user (bool) – If this flag is enabled, the principal identifier of the user will be output to the log.

ExampleMetadata:

infused

Example:

# production stage
prod_log_group = logs.LogGroup(self, "PrdLogs")
api = apigateway.RestApi(self, "books",
    deploy_options=apigateway.StageOptions(
        access_log_destination=apigateway.LogGroupLogDestination(prod_log_group),
        access_log_format=apigateway.AccessLogFormat.json_with_standard_fields()
    )
)
deployment = apigateway.Deployment(self, "Deployment", api=api)

# development stage
dev_log_group = logs.LogGroup(self, "DevLogs")
apigateway.Stage(self, "dev",
    deployment=deployment,
    access_log_destination=apigateway.LogGroupLogDestination(dev_log_group),
    access_log_format=apigateway.AccessLogFormat.json_with_standard_fields(
        caller=False,
        http_method=True,
        ip=True,
        protocol=True,
        request_time=True,
        resource_path=True,
        response_length=True,
        status=True,
        user=True
    )
)

Attributes

caller

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

http_method

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

ip

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

protocol

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

request_time

mm:ss +-hhmm) will be output to the log.

Type:

If this flag is enabled, the CLF-formatted request time((dd/MMM/yyyy

Type:

HH

resource_path

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

response_length

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

status

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

user

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