Skip to content

create_realtime_log_config

create_realtime_log_config(
    end_points: EndPointList,
    fields: FieldList,
    name: string,
    sampling_rate: long,
    *,
    config_overrides: Optional[CloudFrontClientConfig] = None,
) -> CreateRealtimeLogConfigResult

Creates a real-time log configuration.

After you create a real-time log configuration, you can attach it to one or more cache behaviors to send real-time log data to the specified Amazon Kinesis data stream.

For more information about real-time log configurations, see Real-time logs in the Amazon CloudFront Developer Guide.

Parameters:

  • end_points (EndPointList) –

    Contains information about the Amazon Kinesis data stream where you are sending real-time log data.

  • fields (FieldList) –

    A list of fields to include in each real-time log record.

    For more information about fields, see Real-time log configuration fields in the Amazon CloudFront Developer Guide.

  • name (string) –

    A unique name to identify this real-time log configuration.

  • sampling_rate (long) –

    The sampling rate for this real-time log configuration. You can specify a whole number between 1 and 100 (inclusive) to determine the percentage of viewer requests that are represented in the real-time log data.

Raises:

  • AccessDenied –

    Access denied.

  • InvalidArgument –

    An argument is invalid.

  • RealtimeLogConfigAlreadyExists –

    A real-time log configuration with this name already exists. You must provide a unique name. To modify an existing real-time log configuration, use UpdateRealtimeLogConfig.

  • TooManyRealtimeLogConfigs –

    You have reached the maximum number of real-time log configurations for this Amazon Web Services account. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_cloudfront/_services/cloud_front.py
def create_realtime_log_config(
    self,
    end_points: "capo_cloudfront.types.end_point_list.EndPointList",
    fields: "capo_cloudfront.types.field_list.FieldList",
    name: "capo_cloudfront.types.string.string",
    sampling_rate: "capo_cloudfront.types.long.long",
    *,
    config_overrides: Optional[CloudFrontClientConfig] = None,
) -> "capo_cloudfront.types.create_realtime_log_config_result.CreateRealtimeLogConfigResult":
    """<p>Creates a real-time log configuration.</p> <p>After you create a real-time log configuration, you can attach it to one or more cache behaviors to send real-time log data to the specified Amazon Kinesis data stream.</p> <p>For more information about real-time log configurations, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html">Real-time logs</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>

    Args:
        end_points: <p>Contains information about the Amazon Kinesis data stream where you are sending real-time log data.</p>
        fields: <p>A list of fields to include in each real-time log record.</p> <p>For more information about fields, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-fields">Real-time log configuration fields</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
        name: <p>A unique name to identify this real-time log configuration.</p>
        sampling_rate: <p>The sampling rate for this real-time log configuration. You can specify a whole number between 1 and 100 (inclusive) to determine the percentage of viewer requests that are represented in the real-time log data.</p>

    Raises:
        capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
        capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
        capo_cloudfront.errors.realtime_log_config_already_exists.RealtimeLogConfigAlreadyExists: <p>A real-time log configuration with this name already exists. You must provide a unique name. To modify an existing real-time log configuration, use <code>UpdateRealtimeLogConfig</code>.</p>
        capo_cloudfront.errors.too_many_realtime_log_configs.TooManyRealtimeLogConfigs: <p>You have reached the maximum number of real-time log configurations for this Amazon Web Services account. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html">Quotas</a> (formerly known as limits) in the <i>Amazon CloudFront Developer Guide</i>.</p>
        capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudfront.types.create_realtime_log_config_request.CreateRealtimeLogConfigRequest]",
    ) -> OperationResponse[
        "capo_cloudfront.types.create_realtime_log_config_result.CreateRealtimeLogConfigResult"
    ]:
        import capo_cloudfront._operations.cloudfront2020_05_31.create_realtime_log_config

        output, http_response = (
            capo_cloudfront._operations.cloudfront2020_05_31.create_realtime_log_config.create_realtime_log_config(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRealtimeLogConfig")
    )
    input_: capo_cloudfront.types.create_realtime_log_config_request.CreateRealtimeLogConfigRequest = {
        "end_points": end_points,
        "fields": fields,
        "name": name,
        "sampling_rate": sampling_rate,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output