CreateRealtimeLogConfigCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CloudFrontClient, CreateRealtimeLogConfigCommand } from "@aws-sdk/client-cloudfront"; // ES Modules import
// const { CloudFrontClient, CreateRealtimeLogConfigCommand } = require("@aws-sdk/client-cloudfront"); // CommonJS import
const client = new CloudFrontClient(config);
const input = { // CreateRealtimeLogConfigRequest
  EndPoints: [ // EndPointList // required
    { // EndPoint
      StreamType: "STRING_VALUE", // required
      KinesisStreamConfig: { // KinesisStreamConfig
        RoleARN: "STRING_VALUE", // required
        StreamARN: "STRING_VALUE", // required
      },
    },
  ],
  Fields: [ // FieldList // required
    "STRING_VALUE",
  ],
  Name: "STRING_VALUE", // required
  SamplingRate: Number("long"), // required
};
const command = new CreateRealtimeLogConfigCommand(input);
const response = await client.send(command);
// { // CreateRealtimeLogConfigResult
//   RealtimeLogConfig: { // RealtimeLogConfig
//     ARN: "STRING_VALUE", // required
//     Name: "STRING_VALUE", // required
//     SamplingRate: Number("long"), // required
//     EndPoints: [ // EndPointList // required
//       { // EndPoint
//         StreamType: "STRING_VALUE", // required
//         KinesisStreamConfig: { // KinesisStreamConfig
//           RoleARN: "STRING_VALUE", // required
//           StreamARN: "STRING_VALUE", // required
//         },
//       },
//     ],
//     Fields: [ // FieldList // required
//       "STRING_VALUE",
//     ],
//   },
// };

CreateRealtimeLogConfigCommand Input

Parameter
Type
Description
EndPoints
Required
EndPoint[] | undefined

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

Fields
Required
string[] | undefined

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
Required
string | undefined

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

SamplingRate
Required
number | undefined

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.

CreateRealtimeLogConfigCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
RealtimeLogConfig
RealtimeLogConfig | undefined

A real-time log configuration.

Throws

Name
Fault
Details
AccessDenied
client

Access denied.

InvalidArgument
client

An argument is invalid.

RealtimeLogConfigAlreadyExists
client

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
client

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.

CloudFrontServiceException
Base exception class for all service exceptions from CloudFront service.