Amazon CloudWatch Logs

2024/09/04 - Amazon CloudWatch Logs - 2 new3 updated api methods

Changes  Update to support new APIs for delivery of logs from AWS services.

DescribeConfigurationTemplates (new) Link ¶

Use this operation to return the valid and default values that are used when creating delivery sources, delivery destinations, and deliveries. For more information about deliveries, see CreateDelivery.

See also: AWS API Documentation

Request Syntax

client.describe_configuration_templates(
    service='string',
    logTypes=[
        'string',
    ],
    resourceTypes=[
        'string',
    ],
    deliveryDestinationTypes=[
        'S3'|'CWL'|'FH',
    ],
    nextToken='string',
    limit=123
)
type service:

string

param service:

Use this parameter to filter the response to include only the configuration templates that apply to the Amazon Web Services service that you specify here.

type logTypes:

list

param logTypes:

Use this parameter to filter the response to include only the configuration templates that apply to the log types that you specify here.

  • (string) --

type resourceTypes:

list

param resourceTypes:

Use this parameter to filter the response to include only the configuration templates that apply to the resource types that you specify here.

  • (string) --

type deliveryDestinationTypes:

list

param deliveryDestinationTypes:

Use this parameter to filter the response to include only the configuration templates that apply to the delivery destination types that you specify here.

  • (string) --

type nextToken:

string

param nextToken:

The token for the next set of items to return. The token expires after 24 hours.

type limit:

integer

param limit:

Use this parameter to limit the number of configuration templates that are returned in the response.

rtype:

dict

returns:

Response Syntax

{
    'configurationTemplates': [
        {
            'service': 'string',
            'logType': 'string',
            'resourceType': 'string',
            'deliveryDestinationType': 'S3'|'CWL'|'FH',
            'defaultDeliveryConfigValues': {
                'recordFields': [
                    'string',
                ],
                'fieldDelimiter': 'string',
                's3DeliveryConfiguration': {
                    'suffixPath': 'string',
                    'enableHiveCompatiblePath': True|False
                }
            },
            'allowedFields': [
                {
                    'name': 'string',
                    'mandatory': True|False
                },
            ],
            'allowedOutputFormats': [
                'json'|'plain'|'w3c'|'raw'|'parquet',
            ],
            'allowedActionForAllowVendedLogsDeliveryForResource': 'string',
            'allowedFieldDelimiters': [
                'string',
            ],
            'allowedSuffixPathFields': [
                'string',
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • configurationTemplates (list) --

      An array of objects, where each object describes one configuration template that matches the filters that you specified in the request.

      • (dict) --

        A structure containing information about the deafult settings and available settings that you can use to configure a delivery or a delivery destination.

        • service (string) --

          A string specifying which service this configuration template applies to. For more information about supported services see Enable logging from Amazon Web Services services..

        • logType (string) --

          A string specifying which log type this configuration template applies to.

        • resourceType (string) --

          A string specifying which resource type this configuration template applies to.

        • deliveryDestinationType (string) --

          A string specifying which destination type this configuration template applies to.

        • defaultDeliveryConfigValues (dict) --

          A mapping that displays the default value of each property within a delivery’s configuration, if it is not specified in the request.

          • recordFields (list) --

            The default record fields that will be delivered when a list of record fields is not provided in a CreateDelivery operation.

            • (string) --

          • fieldDelimiter (string) --

            The default field delimiter that is used in a CreateDelivery operation when the field delimiter is not specified in that operation. The field delimiter is used only when the final output delivery is in Plain, W3C, or Raw format.

          • s3DeliveryConfiguration (dict) --

            The delivery parameters that are used when you create a delivery to a delivery destination that is an S3 Bucket.

            • suffixPath (string) --

              This string allows re-configuring the S3 object prefix to contain either static or variable sections. The valid variables to use in the suffix path will vary by each log source. See ConfigurationTemplate$allowedSuffixPathFields for more info on what values are supported in the suffix path for each log source.

            • enableHiveCompatiblePath (boolean) --

              This parameter causes the S3 objects that contain delivered logs to use a prefix structure that allows for integration with Apache Hive.

        • allowedFields (list) --

          The allowed fields that a caller can use in the recordFields parameter of a CreateDelivery or UpdateDeliveryConfiguration operation.

        • allowedOutputFormats (list) --

          The list of delivery destination output formats that are supported by this log source.

          • (string) --

        • allowedActionForAllowVendedLogsDeliveryForResource (string) --

          The action permissions that a caller needs to have to be able to successfully create a delivery source on the desired resource type when calling PutDeliverySource.

        • allowedFieldDelimiters (list) --

          The valid values that a caller can use as field delimiters when calling CreateDelivery or UpdateDeliveryConfiguration on a delivery that delivers in Plain, W3C, or Raw format.

          • (string) --

        • allowedSuffixPathFields (list) --

          The list of variable fields that can be used in the suffix path of a delivery that delivers to an S3 bucket.

          • (string) --

    • nextToken (string) --

      The token for the next set of items to return. The token expires after 24 hours.

UpdateDeliveryConfiguration (new) Link ¶

Use this operation to update the configuration of a delivery to change either the S3 path pattern or the format of the delivered logs. You can't use this operation to change the source or destination of the delivery.

See also: AWS API Documentation

Request Syntax

client.update_delivery_configuration(
    id='string',
    recordFields=[
        'string',
    ],
    fieldDelimiter='string',
    s3DeliveryConfiguration={
        'suffixPath': 'string',
        'enableHiveCompatiblePath': True|False
    }
)
type id:

string

param id:

[REQUIRED]

The ID of the delivery to be updated by this request.

type recordFields:

list

param recordFields:

The list of record fields to be delivered to the destination, in order. If the delivery’s log source has mandatory fields, they must be included in this list.

  • (string) --

type fieldDelimiter:

string

param fieldDelimiter:

The field delimiter to use between record fields when the final output format of a delivery is in Plain, W3C, or Raw format.

type s3DeliveryConfiguration:

dict

param s3DeliveryConfiguration:

This structure contains parameters that are valid only when the delivery’s delivery destination is an S3 bucket.

  • suffixPath (string) --

    This string allows re-configuring the S3 object prefix to contain either static or variable sections. The valid variables to use in the suffix path will vary by each log source. See ConfigurationTemplate$allowedSuffixPathFields for more info on what values are supported in the suffix path for each log source.

  • enableHiveCompatiblePath (boolean) --

    This parameter causes the S3 objects that contain delivered logs to use a prefix structure that allows for integration with Apache Hive.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

CreateDelivery (updated) Link ¶
Changes (request, response)
Request
{'fieldDelimiter': 'string',
 'recordFields': ['string'],
 's3DeliveryConfiguration': {'enableHiveCompatiblePath': 'boolean',
                             'suffixPath': 'string'}}
Response
{'delivery': {'fieldDelimiter': 'string',
              'recordFields': ['string'],
              's3DeliveryConfiguration': {'enableHiveCompatiblePath': 'boolean',
                                          'suffixPath': 'string'}}}

Creates a delivery. A delivery is a connection between a logical delivery source and a logical delivery destination that you have already created.

Only some Amazon Web Services services support being configured as a delivery source using this operation. These services are listed as Supported [V2 Permissions] in the table at Enabling logging from Amazon Web Services services.

A delivery destination can represent a log group in CloudWatch Logs, an Amazon S3 bucket, or a delivery stream in Firehose.

To configure logs delivery between a supported Amazon Web Services service and a destination, you must do the following:

  • Create a delivery source, which is a logical object that represents the resource that is actually sending the logs. For more information, see PutDeliverySource.

  • Create a delivery destination, which is a logical object that represents the actual delivery destination. For more information, see PutDeliveryDestination.

  • If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy in the destination account to assign an IAM policy to the destination. This policy allows delivery to that destination.

  • Use CreateDelivery to create a delivery by pairing exactly one delivery source and one delivery destination.

You can configure a single delivery source to send logs to multiple destinations by creating multiple deliveries. You can also create multiple deliveries to configure multiple delivery sources to send logs to the same delivery destination.

You can't update an existing delivery. You can only create and delete deliveries.

See also: AWS API Documentation

Request Syntax

client.create_delivery(
    deliverySourceName='string',
    deliveryDestinationArn='string',
    recordFields=[
        'string',
    ],
    fieldDelimiter='string',
    s3DeliveryConfiguration={
        'suffixPath': 'string',
        'enableHiveCompatiblePath': True|False
    },
    tags={
        'string': 'string'
    }
)
type deliverySourceName:

string

param deliverySourceName:

[REQUIRED]

The name of the delivery source to use for this delivery.

type deliveryDestinationArn:

string

param deliveryDestinationArn:

[REQUIRED]

The ARN of the delivery destination to use for this delivery.

type recordFields:

list

param recordFields:

The list of record fields to be delivered to the destination, in order. If the delivery’s log source has mandatory fields, they must be included in this list.

  • (string) --

type fieldDelimiter:

string

param fieldDelimiter:

The field delimiter to use between record fields when the final output format of a delivery is in Plain, W3C, or Raw format.

type s3DeliveryConfiguration:

dict

param s3DeliveryConfiguration:

This structure contains parameters that are valid only when the delivery’s delivery destination is an S3 bucket.

  • suffixPath (string) --

    This string allows re-configuring the S3 object prefix to contain either static or variable sections. The valid variables to use in the suffix path will vary by each log source. See ConfigurationTemplate$allowedSuffixPathFields for more info on what values are supported in the suffix path for each log source.

  • enableHiveCompatiblePath (boolean) --

    This parameter causes the S3 objects that contain delivered logs to use a prefix structure that allows for integration with Apache Hive.

type tags:

dict

param tags:

An optional list of key-value pairs to associate with the resource.

For more information about tagging, see Tagging Amazon Web Services resources

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{
    'delivery': {
        'id': 'string',
        'arn': 'string',
        'deliverySourceName': 'string',
        'deliveryDestinationArn': 'string',
        'deliveryDestinationType': 'S3'|'CWL'|'FH',
        'recordFields': [
            'string',
        ],
        'fieldDelimiter': 'string',
        's3DeliveryConfiguration': {
            'suffixPath': 'string',
            'enableHiveCompatiblePath': True|False
        },
        'tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • delivery (dict) --

      A structure that contains information about the delivery that you just created.

      • id (string) --

        The unique ID that identifies this delivery in your account.

      • arn (string) --

        The Amazon Resource Name (ARN) that uniquely identifies this delivery.

      • deliverySourceName (string) --

        The name of the delivery source that is associated with this delivery.

      • deliveryDestinationArn (string) --

        The ARN of the delivery destination that is associated with this delivery.

      • deliveryDestinationType (string) --

        Displays whether the delivery destination associated with this delivery is CloudWatch Logs, Amazon S3, or Firehose.

      • recordFields (list) --

        The record fields used in this delivery.

        • (string) --

      • fieldDelimiter (string) --

        The field delimiter that is used between record fields when the final output format of a delivery is in Plain, W3C, or Raw format.

      • s3DeliveryConfiguration (dict) --

        This structure contains delivery configurations that apply only when the delivery destination resource is an S3 bucket.

        • suffixPath (string) --

          This string allows re-configuring the S3 object prefix to contain either static or variable sections. The valid variables to use in the suffix path will vary by each log source. See ConfigurationTemplate$allowedSuffixPathFields for more info on what values are supported in the suffix path for each log source.

        • enableHiveCompatiblePath (boolean) --

          This parameter causes the S3 objects that contain delivered logs to use a prefix structure that allows for integration with Apache Hive.

      • tags (dict) --

        The tags that have been assigned to this delivery.

        • (string) --

          • (string) --

DescribeDeliveries (updated) Link ¶
Changes (response)
{'deliveries': {'fieldDelimiter': 'string',
                'recordFields': ['string'],
                's3DeliveryConfiguration': {'enableHiveCompatiblePath': 'boolean',
                                            'suffixPath': 'string'}}}

Retrieves a list of the deliveries that have been created in the account.

A delivery is a connection between a delivery source and a delivery destination.

A delivery source represents an Amazon Web Services resource that sends logs to an logs delivery destination. The destination can be CloudWatch Logs, Amazon S3, or Firehose. Only some Amazon Web Services services support being configured as a delivery source. These services are listed in Enable logging from Amazon Web Services services.

See also: AWS API Documentation

Request Syntax

client.describe_deliveries(
    nextToken='string',
    limit=123
)
type nextToken:

string

param nextToken:

The token for the next set of items to return. The token expires after 24 hours.

type limit:

integer

param limit:

Optionally specify the maximum number of deliveries to return in the response.

rtype:

dict

returns:

Response Syntax

{
    'deliveries': [
        {
            'id': 'string',
            'arn': 'string',
            'deliverySourceName': 'string',
            'deliveryDestinationArn': 'string',
            'deliveryDestinationType': 'S3'|'CWL'|'FH',
            'recordFields': [
                'string',
            ],
            'fieldDelimiter': 'string',
            's3DeliveryConfiguration': {
                'suffixPath': 'string',
                'enableHiveCompatiblePath': True|False
            },
            'tags': {
                'string': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • deliveries (list) --

      An array of structures. Each structure contains information about one delivery in the account.

      • (dict) --

        This structure contains information about one delivery in your account.

        A delivery is a connection between a logical delivery source and a logical delivery destination.

        For more information, see CreateDelivery.

        You can't update an existing delivery. You can only create and delete deliveries.

        • id (string) --

          The unique ID that identifies this delivery in your account.

        • arn (string) --

          The Amazon Resource Name (ARN) that uniquely identifies this delivery.

        • deliverySourceName (string) --

          The name of the delivery source that is associated with this delivery.

        • deliveryDestinationArn (string) --

          The ARN of the delivery destination that is associated with this delivery.

        • deliveryDestinationType (string) --

          Displays whether the delivery destination associated with this delivery is CloudWatch Logs, Amazon S3, or Firehose.

        • recordFields (list) --

          The record fields used in this delivery.

          • (string) --

        • fieldDelimiter (string) --

          The field delimiter that is used between record fields when the final output format of a delivery is in Plain, W3C, or Raw format.

        • s3DeliveryConfiguration (dict) --

          This structure contains delivery configurations that apply only when the delivery destination resource is an S3 bucket.

          • suffixPath (string) --

            This string allows re-configuring the S3 object prefix to contain either static or variable sections. The valid variables to use in the suffix path will vary by each log source. See ConfigurationTemplate$allowedSuffixPathFields for more info on what values are supported in the suffix path for each log source.

          • enableHiveCompatiblePath (boolean) --

            This parameter causes the S3 objects that contain delivered logs to use a prefix structure that allows for integration with Apache Hive.

        • tags (dict) --

          The tags that have been assigned to this delivery.

          • (string) --

            • (string) --

    • nextToken (string) --

      The token for the next set of items to return. The token expires after 24 hours.

GetDelivery (updated) Link ¶
Changes (response)
{'delivery': {'fieldDelimiter': 'string',
              'recordFields': ['string'],
              's3DeliveryConfiguration': {'enableHiveCompatiblePath': 'boolean',
                                          'suffixPath': 'string'}}}

Returns complete information about one logical delivery. A delivery is a connection between a delivery source and a delivery destination.

A delivery source represents an Amazon Web Services resource that sends logs to an logs delivery destination. The destination can be CloudWatch Logs, Amazon S3, or Firehose. Only some Amazon Web Services services support being configured as a delivery source. These services are listed in Enable logging from Amazon Web Services services.

You need to specify the delivery id in this operation. You can find the IDs of the deliveries in your account with the DescribeDeliveries operation.

See also: AWS API Documentation

Request Syntax

client.get_delivery(
    id='string'
)
type id:

string

param id:

[REQUIRED]

The ID of the delivery that you want to retrieve.

rtype:

dict

returns:

Response Syntax

{
    'delivery': {
        'id': 'string',
        'arn': 'string',
        'deliverySourceName': 'string',
        'deliveryDestinationArn': 'string',
        'deliveryDestinationType': 'S3'|'CWL'|'FH',
        'recordFields': [
            'string',
        ],
        'fieldDelimiter': 'string',
        's3DeliveryConfiguration': {
            'suffixPath': 'string',
            'enableHiveCompatiblePath': True|False
        },
        'tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • delivery (dict) --

      A structure that contains information about the delivery.

      • id (string) --

        The unique ID that identifies this delivery in your account.

      • arn (string) --

        The Amazon Resource Name (ARN) that uniquely identifies this delivery.

      • deliverySourceName (string) --

        The name of the delivery source that is associated with this delivery.

      • deliveryDestinationArn (string) --

        The ARN of the delivery destination that is associated with this delivery.

      • deliveryDestinationType (string) --

        Displays whether the delivery destination associated with this delivery is CloudWatch Logs, Amazon S3, or Firehose.

      • recordFields (list) --

        The record fields used in this delivery.

        • (string) --

      • fieldDelimiter (string) --

        The field delimiter that is used between record fields when the final output format of a delivery is in Plain, W3C, or Raw format.

      • s3DeliveryConfiguration (dict) --

        This structure contains delivery configurations that apply only when the delivery destination resource is an S3 bucket.

        • suffixPath (string) --

          This string allows re-configuring the S3 object prefix to contain either static or variable sections. The valid variables to use in the suffix path will vary by each log source. See ConfigurationTemplate$allowedSuffixPathFields for more info on what values are supported in the suffix path for each log source.

        • enableHiveCompatiblePath (boolean) --

          This parameter causes the S3 objects that contain delivered logs to use a prefix structure that allows for integration with Apache Hive.

      • tags (dict) --

        The tags that have been assigned to this delivery.

        • (string) --

          • (string) --