SDK for PHP 3.x

Client: Aws\CloudWatchLogs\CloudWatchLogsClient
Service ID: logs
Version: 2014-03-28

This page describes the parameters and results for the operations of the Amazon CloudWatch Logs (2014-03-28), and shows how to use the Aws\CloudWatchLogs\CloudWatchLogsClient object to call the described operations. This documentation is specific to the 2014-03-28 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

AssociateKmsKey ( array $params = [] )
Associates the specified KMS key with either one log group in the account, or with all stored CloudWatch Logs query insights results in the account.
CancelExportTask ( array $params = [] )
Cancels the specified export task.
CreateDelivery ( array $params = [] )
Creates a delivery.
CreateExportTask ( array $params = [] )
Creates an export task so that you can efficiently export data from a log group to an Amazon S3 bucket.
CreateLogAnomalyDetector ( array $params = [] )
Creates an anomaly detector that regularly scans one or more log groups and look for patterns and anomalies in the logs.
CreateLogGroup ( array $params = [] )
Creates a log group with the specified name.
CreateLogStream ( array $params = [] )
Creates a log stream for the specified log group.
DeleteAccountPolicy ( array $params = [] )
Deletes a CloudWatch Logs account policy.
DeleteDataProtectionPolicy ( array $params = [] )
Deletes the data protection policy from the specified log group.
DeleteDelivery ( array $params = [] )
Deletes s delivery.
DeleteDeliveryDestination ( array $params = [] )
Deletes a delivery destination.
DeleteDeliveryDestinationPolicy ( array $params = [] )
Deletes a delivery destination policy.
DeleteDeliverySource ( array $params = [] )
Deletes a delivery source.
DeleteDestination ( array $params = [] )
Deletes the specified destination, and eventually disables all the subscription filters that publish to it.
DeleteIndexPolicy ( array $params = [] )
Deletes a log-group level field index policy that was applied to a single log group.
DeleteIntegration ( array $params = [] )
Deletes the integration between CloudWatch Logs and OpenSearch Service.
DeleteLogAnomalyDetector ( array $params = [] )
Deletes the specified CloudWatch Logs anomaly detector.
DeleteLogGroup ( array $params = [] )
Deletes the specified log group and permanently deletes all the archived log events associated with the log group.
DeleteLogStream ( array $params = [] )
Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.
DeleteMetricFilter ( array $params = [] )
Deletes the specified metric filter.
DeleteQueryDefinition ( array $params = [] )
Deletes a saved CloudWatch Logs Insights query definition.
DeleteResourcePolicy ( array $params = [] )
Deletes a resource policy from this account.
DeleteRetentionPolicy ( array $params = [] )
Deletes the specified retention policy.
DeleteSubscriptionFilter ( array $params = [] )
Deletes the specified subscription filter.
DeleteTransformer ( array $params = [] )
Deletes the log transformer for the specified log group.
DescribeAccountPolicies ( array $params = [] )
Returns a list of all CloudWatch Logs account policies in the account.
DescribeConfigurationTemplates ( array $params = [] )
Use this operation to return the valid and default values that are used when creating delivery sources, delivery destinations, and deliveries.
DescribeDeliveries ( array $params = [] )
Retrieves a list of the deliveries that have been created in the account.
DescribeDeliveryDestinations ( array $params = [] )
Retrieves a list of the delivery destinations that have been created in the account.
DescribeDeliverySources ( array $params = [] )
Retrieves a list of the delivery sources that have been created in the account.
DescribeDestinations ( array $params = [] )
Lists all your destinations.
DescribeExportTasks ( array $params = [] )
Lists the specified export tasks.
DescribeFieldIndexes ( array $params = [] )
Returns a list of field indexes listed in the field index policies of one or more log groups.
DescribeIndexPolicies ( array $params = [] )
Returns the field index policies of one or more log groups.
DescribeLogGroups ( array $params = [] )
Lists the specified log groups.
DescribeLogStreams ( array $params = [] )
Lists the log streams for the specified log group.
DescribeMetricFilters ( array $params = [] )
Lists the specified metric filters.
DescribeQueries ( array $params = [] )
Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account.
DescribeQueryDefinitions ( array $params = [] )
This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions.
DescribeResourcePolicies ( array $params = [] )
Lists the resource policies in this account.
DescribeSubscriptionFilters ( array $params = [] )
Lists the subscription filters for the specified log group.
DisassociateKmsKey ( array $params = [] )
Disassociates the specified KMS key from the specified log group or from all CloudWatch Logs Insights query results in the account.
FilterLogEvents ( array $params = [] )
Lists log events from the specified log group.
GetDataProtectionPolicy ( array $params = [] )
Returns information about a log group data protection policy.
GetDelivery ( array $params = [] )
Returns complete information about one logical delivery.
GetDeliveryDestination ( array $params = [] )
Retrieves complete information about one delivery destination.
GetDeliveryDestinationPolicy ( array $params = [] )
Retrieves the delivery destination policy assigned to the delivery destination that you specify.
GetDeliverySource ( array $params = [] )
Retrieves complete information about one delivery source.
GetIntegration ( array $params = [] )
Returns information about one integration between CloudWatch Logs and OpenSearch Service.
GetLogAnomalyDetector ( array $params = [] )
Retrieves information about the log anomaly detector that you specify.
GetLogEvents ( array $params = [] )
Lists log events from the specified log stream.
GetLogGroupFields ( array $params = [] )
Returns a list of the fields that are included in log events in the specified log group.
GetLogRecord ( array $params = [] )
Retrieves all of the fields and values of a single log event.
GetQueryResults ( array $params = [] )
Returns the results from the specified query.
GetTransformer ( array $params = [] )
Returns the information about the log transformer associated with this log group.
ListAnomalies ( array $params = [] )
Returns a list of anomalies that log anomaly detectors have found.
ListIntegrations ( array $params = [] )
Returns a list of integrations between CloudWatch Logs and other services in this account.
ListLogAnomalyDetectors ( array $params = [] )
Retrieves a list of the log anomaly detectors in the account.
ListLogGroupsForQuery ( array $params = [] )
Returns a list of the log groups that were analyzed during a single CloudWatch Logs Insights query.
ListTagsForResource ( array $params = [] )
Displays the tags associated with a CloudWatch Logs resource.
ListTagsLogGroup ( array $params = [] )
The ListTagsLogGroup operation is on the path to deprecation.
PutAccountPolicy ( array $params = [] )
Creates an account-level data protection policy, subscription filter policy, or field index policy that applies to all log groups or a subset of log groups in the account.
PutDataProtectionPolicy ( array $params = [] )
Creates a data protection policy for the specified log group.
PutDeliveryDestination ( array $params = [] )
Creates or updates a logical delivery destination.
PutDeliveryDestinationPolicy ( array $params = [] )
Creates and assigns an IAM policy that grants permissions to CloudWatch Logs to deliver logs cross-account to a specified destination in this account.
PutDeliverySource ( array $params = [] )
Creates or updates a logical delivery source.
PutDestination ( array $params = [] )
Creates or updates a destination.
PutDestinationPolicy ( array $params = [] )
Creates or updates an access policy associated with an existing destination.
PutIndexPolicy ( array $params = [] )
Creates or updates a field index policy for the specified log group.
PutIntegration ( array $params = [] )
Creates an integration between CloudWatch Logs and another service in this account.
PutLogEvents ( array $params = [] )
Uploads a batch of log events to the specified log stream.
PutMetricFilter ( array $params = [] )
Creates or updates a metric filter and associates it with the specified log group.
PutQueryDefinition ( array $params = [] )
Creates or updates a query definition for CloudWatch Logs Insights.
PutResourcePolicy ( array $params = [] )
Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53.
PutRetentionPolicy ( array $params = [] )
Sets the retention of the specified log group.
PutSubscriptionFilter ( array $params = [] )
Creates or updates a subscription filter and associates it with the specified log group.
PutTransformer ( array $params = [] )
Creates or updates a log transformer for a single log group.
StartLiveTail ( array $params = [] )
Starts a Live Tail streaming session for one or more log groups.
StartQuery ( array $params = [] )
Starts a query of one or more log groups using CloudWatch Logs Insights.
StopQuery ( array $params = [] )
Stops a CloudWatch Logs Insights query that is in progress.
TagLogGroup ( array $params = [] )
The TagLogGroup operation is on the path to deprecation.
TagResource ( array $params = [] )
Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs resource.
TestMetricFilter ( array $params = [] )
Tests the filter pattern of a metric filter against a sample of log event messages.
TestTransformer ( array $params = [] )
Use this operation to test a log transformer.
UntagLogGroup ( array $params = [] )
The UntagLogGroup operation is on the path to deprecation.
UntagResource ( array $params = [] )
Removes one or more tags from the specified resource.
UpdateAnomaly ( array $params = [] )
Use this operation to suppress anomaly detection for a specified anomaly or pattern.
UpdateDeliveryConfiguration ( array $params = [] )
Use this operation to update the configuration of a delivery to change either the S3 path pattern or the format of the delivered logs.
UpdateLogAnomalyDetector ( array $params = [] )
Updates an existing log anomaly detector.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

DescribeConfigurationTemplates
DescribeDeliveries
DescribeDeliveryDestinations
DescribeDeliverySources
DescribeDestinations
DescribeLogGroups
DescribeLogStreams
DescribeMetricFilters
DescribeSubscriptionFilters
FilterLogEvents
GetLogEvents
ListAnomalies
ListLogAnomalyDetectors
ListLogGroupsForQuery

Operations

AssociateKmsKey

$result = $client->associateKmsKey([/* ... */]);
$promise = $client->associateKmsKeyAsync([/* ... */]);

Associates the specified KMS key with either one log group in the account, or with all stored CloudWatch Logs query insights results in the account.

When you use AssociateKmsKey, you specify either the logGroupName parameter or the resourceIdentifier parameter. You can't specify both of those parameters in the same operation.

  • Specify the logGroupName parameter to cause all log events stored in the log group to be encrypted with that key. Only the log events ingested after the key is associated are encrypted with that key.

    Associating a KMS key with a log group overrides any existing associations between the log group and a KMS key. After a KMS key is associated with a log group, all newly ingested data for the log group is encrypted using the KMS key. This association is stored as long as the data encrypted with the KMS key is still within CloudWatch Logs. This enables CloudWatch Logs to decrypt this data whenever it is requested.

    Associating a key with a log group does not cause the results of queries of that log group to be encrypted with that key. To have query results encrypted with a KMS key, you must use an AssociateKmsKey operation with the resourceIdentifier parameter that specifies a query-result resource.

  • Specify the resourceIdentifier parameter with a query-result resource, to use that key to encrypt the stored results of all future StartQuery operations in the account. The response from a GetQueryResults operation will still return the query results in plain text.

    Even if you have not associated a key with your query results, the query results are encrypted when stored, using the default CloudWatch Logs method.

    If you run a query from a monitoring account that queries logs in a source account, the query results key from the monitoring account, if any, is used.

If you delete the key that is used to encrypt log events or log group query results, then all the associated stored log events or query results that were encrypted with that key will be unencryptable and unusable.

CloudWatch Logs supports only symmetric KMS keys. Do not use an associate an asymmetric KMS key with your log group or query results. For more information, see Using Symmetric and Asymmetric Keys.

It can take up to 5 minutes for this operation to take effect.

If you attempt to associate a KMS key with a log group but the KMS key does not exist or the KMS key is disabled, you receive an InvalidParameterException error.

Parameter Syntax

$result = $client->associateKmsKey([
    'kmsKeyId' => '<string>', // REQUIRED
    'logGroupName' => '<string>',
    'resourceIdentifier' => '<string>',
]);

Parameter Details

Members
kmsKeyId
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. This must be a symmetric KMS key. For more information, see Amazon Resource Names and Using Symmetric and Asymmetric Keys.

logGroupName
Type: string

The name of the log group.

In your AssociateKmsKey operation, you must specify either the resourceIdentifier parameter or the logGroup parameter, but you can't specify both.

resourceIdentifier
Type: string

Specifies the target for this operation. You must specify one of the following:

  • Specify the following ARN to have future GetQueryResults operations in this account encrypt the results with the specified KMS key. Replace REGION and ACCOUNT_ID with your Region and account ID.

    arn:aws:logs:REGION:ACCOUNT_ID:query-result:*

  • Specify the ARN of a log group to have CloudWatch Logs use the KMS key to encrypt log events that are ingested and stored by that log group. The log group ARN must be in the following format. Replace REGION and ACCOUNT_ID with your Region and account ID.

    arn:aws:logs:REGION:ACCOUNT_ID:log-group:LOG_GROUP_NAME

In your AssociateKmsKey operation, you must specify either the resourceIdentifier parameter or the logGroup parameter, but you can't specify both.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

CancelExportTask

$result = $client->cancelExportTask([/* ... */]);
$promise = $client->cancelExportTaskAsync([/* ... */]);

Cancels the specified export task.

The task must be in the PENDING or RUNNING state.

Parameter Syntax

$result = $client->cancelExportTask([
    'taskId' => '<string>', // REQUIRED
]);

Parameter Details

Members
taskId
Required: Yes
Type: string

The ID of the export task.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

InvalidOperationException:

The operation is not valid on the specified resource.

ServiceUnavailableException:

The service cannot complete the request.

CreateDelivery

$result = $client->createDelivery([/* ... */]);
$promise = $client->createDeliveryAsync([/* ... */]);

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.

To update an existing delivery configuration, use UpdateDeliveryConfiguration.

Parameter Syntax

$result = $client->createDelivery([
    'deliveryDestinationArn' => '<string>', // REQUIRED
    'deliverySourceName' => '<string>', // REQUIRED
    'fieldDelimiter' => '<string>',
    'recordFields' => ['<string>', ...],
    's3DeliveryConfiguration' => [
        'enableHiveCompatiblePath' => true || false,
        'suffixPath' => '<string>',
    ],
    'tags' => ['<string>', ...],
]);

Parameter Details

Members
deliveryDestinationArn
Required: Yes
Type: string

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

deliverySourceName
Required: Yes
Type: string

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

fieldDelimiter
Type: string

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

recordFields
Type: Array of strings

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.

s3DeliveryConfiguration
Type: S3DeliveryConfiguration structure

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

tags
Type: Associative array of custom strings keys (TagKey) to strings

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

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

Result Syntax

[
    'delivery' => [
        'arn' => '<string>',
        'deliveryDestinationArn' => '<string>',
        'deliveryDestinationType' => 'S3|CWL|FH',
        'deliverySourceName' => '<string>',
        'fieldDelimiter' => '<string>',
        'id' => '<string>',
        'recordFields' => ['<string>', ...],
        's3DeliveryConfiguration' => [
            'enableHiveCompatiblePath' => true || false,
            'suffixPath' => '<string>',
        ],
        'tags' => ['<string>', ...],
    ],
]

Result Details

Members
delivery
Type: Delivery structure

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

Errors

ServiceUnavailableException:

The service cannot complete the request.

ConflictException:

This operation attempted to create a resource that already exists.

ResourceNotFoundException:

The specified resource does not exist.

ValidationException:

One of the parameters for the request is not valid.

AccessDeniedException:

You don't have sufficient permissions to perform this action.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

CreateExportTask

$result = $client->createExportTask([/* ... */]);
$promise = $client->createExportTaskAsync([/* ... */]);

Creates an export task so that you can efficiently export data from a log group to an Amazon S3 bucket. When you perform a CreateExportTask operation, you must use credentials that have permission to write to the S3 bucket that you specify as the destination.

Exporting log data to S3 buckets that are encrypted by KMS is supported. Exporting log data to Amazon S3 buckets that have S3 Object Lock enabled with a retention period is also supported.

Exporting to S3 buckets that are encrypted with AES-256 is supported.

This is an asynchronous call. If all the required information is provided, this operation initiates an export task and responds with the ID of the task. After the task has started, you can use DescribeExportTasks to get the status of the export task. Each account can only have one active (RUNNING or PENDING) export task at a time. To cancel an export task, use CancelExportTask.

You can export logs from multiple log groups or multiple time ranges to the same S3 bucket. To separate log data for each export task, specify a prefix to be used as the Amazon S3 key prefix for all exported objects.

Time-based sorting on chunks of log data inside an exported file is not guaranteed. You can sort the exported log field data by using Linux utilities.

Parameter Syntax

$result = $client->createExportTask([
    'destination' => '<string>', // REQUIRED
    'destinationPrefix' => '<string>',
    'from' => <integer>, // REQUIRED
    'logGroupName' => '<string>', // REQUIRED
    'logStreamNamePrefix' => '<string>',
    'taskName' => '<string>',
    'to' => <integer>, // REQUIRED
]);

Parameter Details

Members
destination
Required: Yes
Type: string

The name of S3 bucket for the exported log data. The bucket must be in the same Amazon Web Services Region.

destinationPrefix
Type: string

The prefix used as the start of the key for every object exported. If you don't specify a value, the default is exportedlogs.

The length of this parameter must comply with the S3 object key name length limits. The object key name is a sequence of Unicode characters with UTF-8 encoding, and can be up to 1,024 bytes.

from
Required: Yes
Type: long (int|float)

The start time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp earlier than this time are not exported.

logGroupName
Required: Yes
Type: string

The name of the log group.

logStreamNamePrefix
Type: string

Export only log streams that match the provided prefix. If you don't specify a value, no prefix filter is applied.

taskName
Type: string

The name of the export task.

to
Required: Yes
Type: long (int|float)

The end time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported.

You must specify a time that is not earlier than when this log group was created.

Result Syntax

[
    'taskId' => '<string>',
]

Result Details

Members
taskId
Type: string

The ID of the export task.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

ResourceNotFoundException:

The specified resource does not exist.

ResourceAlreadyExistsException:

The specified resource already exists.

CreateLogAnomalyDetector

$result = $client->createLogAnomalyDetector([/* ... */]);
$promise = $client->createLogAnomalyDetectorAsync([/* ... */]);

Creates an anomaly detector that regularly scans one or more log groups and look for patterns and anomalies in the logs.

An anomaly detector can help surface issues by automatically discovering anomalies in your log event traffic. An anomaly detector uses machine learning algorithms to scan log events and find patterns. A pattern is a shared text structure that recurs among your log fields. Patterns provide a useful tool for analyzing large sets of logs because a large number of log events can often be compressed into a few patterns.

The anomaly detector uses pattern recognition to find anomalies, which are unusual log events. It uses the evaluationFrequency to compare current log events and patterns with trained baselines.

Fields within a pattern are called tokens. Fields that vary within a pattern, such as a request ID or timestamp, are referred to as dynamic tokens and represented by <*>.

The following is an example of a pattern:

[INFO] Request time: <*> ms

This pattern represents log events like [INFO] Request time: 327 ms and other similar log events that differ only by the number, in this csse 327. When the pattern is displayed, the different numbers are replaced by <*>

Any parts of log events that are masked as sensitive data are not scanned for anomalies. For more information about masking sensitive data, see Help protect sensitive log data with masking.

Parameter Syntax

$result = $client->createLogAnomalyDetector([
    'anomalyVisibilityTime' => <integer>,
    'detectorName' => '<string>',
    'evaluationFrequency' => 'ONE_MIN|FIVE_MIN|TEN_MIN|FIFTEEN_MIN|THIRTY_MIN|ONE_HOUR',
    'filterPattern' => '<string>',
    'kmsKeyId' => '<string>',
    'logGroupArnList' => ['<string>', ...], // REQUIRED
    'tags' => ['<string>', ...],
]);

Parameter Details

Members
anomalyVisibilityTime
Type: long (int|float)

The number of days to have visibility on an anomaly. After this time period has elapsed for an anomaly, it will be automatically baselined and the anomaly detector will treat new occurrences of a similar anomaly as normal. Therefore, if you do not correct the cause of an anomaly during the time period specified in anomalyVisibilityTime, it will be considered normal going forward and will not be detected as an anomaly.

detectorName
Type: string

A name for this anomaly detector.

evaluationFrequency
Type: string

Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to the frequency that the log group receives new logs. For example, if the log group receives new log events every 10 minutes, then 15 minutes might be a good setting for evaluationFrequency .

filterPattern
Type: string

You can use this parameter to limit the anomaly detection model to examine only log events that match the pattern you specify here. For more information, see Filter and Pattern Syntax.

kmsKeyId
Type: string

Optionally assigns a KMS key to secure this anomaly detector and its findings. If a key is assigned, the anomalies found and the model used by this detector are encrypted at rest with the key. If a key is assigned to an anomaly detector, a user must have permissions for both this key and for the anomaly detector to retrieve information about the anomalies that it finds.

For more information about using a KMS key and to see the required IAM policy, see Use a KMS key with an anomaly detector.

logGroupArnList
Required: Yes
Type: Array of strings

An array containing the ARN of the log group that this anomaly detector will watch. You can specify only one log group ARN.

tags
Type: Associative array of custom strings keys (TagKey) to strings

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

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

Result Syntax

[
    'anomalyDetectorArn' => '<string>',
]

Result Details

Members
anomalyDetectorArn
Type: string

The ARN of the log anomaly detector that you just created.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

LimitExceededException:

You have reached the maximum number of resources that can be created.

CreateLogGroup

$result = $client->createLogGroup([/* ... */]);
$promise = $client->createLogGroupAsync([/* ... */]);

Creates a log group with the specified name. You can create up to 1,000,000 log groups per Region per account.

You must use the following guidelines when naming a log group:

  • Log group names must be unique within a Region for an Amazon Web Services account.

  • Log group names can be between 1 and 512 characters long.

  • Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), '.' (period), and '#' (number sign)

  • Log group names can't start with the string aws/

When you create a log group, by default the log events in the log group do not expire. To set a retention policy so that events expire and are deleted after a specified time, use PutRetentionPolicy.

If you associate an KMS key with the log group, ingested data is encrypted using the KMS key. This association is stored as long as the data encrypted with the KMS key is still within CloudWatch Logs. This enables CloudWatch Logs to decrypt this data whenever it is requested.

If you attempt to associate a KMS key with the log group but the KMS key does not exist or the KMS key is disabled, you receive an InvalidParameterException error.

CloudWatch Logs supports only symmetric KMS keys. Do not associate an asymmetric KMS key with your log group. For more information, see Using Symmetric and Asymmetric Keys.

Parameter Syntax

$result = $client->createLogGroup([
    'kmsKeyId' => '<string>',
    'logGroupClass' => 'STANDARD|INFREQUENT_ACCESS',
    'logGroupName' => '<string>', // REQUIRED
    'tags' => ['<string>', ...],
]);

Parameter Details

Members
kmsKeyId
Type: string

The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. For more information, see Amazon Resource Names.

logGroupClass
Type: string

Use this parameter to specify the log group class for this log group. There are two classes:

  • The Standard log class supports all CloudWatch Logs features.

  • The Infrequent Access log class supports a subset of CloudWatch Logs features and incurs lower costs.

If you omit this parameter, the default of STANDARD is used.

The value of logGroupClass can't be changed after a log group is created.

For details about the features supported by each class, see Log classes

logGroupName
Required: Yes
Type: string

A name for the log group.

tags
Type: Associative array of custom strings keys (TagKey) to strings

The key-value pairs to use for the tags.

You can grant users access to certain log groups while preventing them from accessing other log groups. To do so, tag your groups and use IAM policies that refer to those tags. To assign tags when you create a log group, you must have either the logs:TagResource or logs:TagLogGroup permission. For more information about tagging, see Tagging Amazon Web Services resources. For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceAlreadyExistsException:

The specified resource already exists.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

CreateLogStream

$result = $client->createLogStream([/* ... */]);
$promise = $client->createLogStreamAsync([/* ... */]);

Creates a log stream for the specified log group. A log stream is a sequence of log events that originate from a single source, such as an application instance or a resource that is being monitored.

There is no limit on the number of log streams that you can create for a log group. There is a limit of 50 TPS on CreateLogStream operations, after which transactions are throttled.

You must use the following guidelines when naming a log stream:

  • Log stream names must be unique within the log group.

  • Log stream names can be between 1 and 512 characters long.

  • Don't use ':' (colon) or '*' (asterisk) characters.

Parameter Syntax

$result = $client->createLogStream([
    'logGroupName' => '<string>', // REQUIRED
    'logStreamName' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

logStreamName
Required: Yes
Type: string

The name of the log stream.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceAlreadyExistsException:

The specified resource already exists.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DeleteAccountPolicy

$result = $client->deleteAccountPolicy([/* ... */]);
$promise = $client->deleteAccountPolicyAsync([/* ... */]);

Deletes a CloudWatch Logs account policy. This stops the account-wide policy from applying to log groups in the account. If you delete a data protection policy or subscription filter policy, any log-group level policies of those types remain in effect.

To use this operation, you must be signed on with the correct permissions depending on the type of policy that you are deleting.

  • To delete a data protection policy, you must have the logs:DeleteDataProtectionPolicy and logs:DeleteAccountPolicy permissions.

  • To delete a subscription filter policy, you must have the logs:DeleteSubscriptionFilter and logs:DeleteAccountPolicy permissions.

  • To delete a transformer policy, you must have the logs:DeleteTransformer and logs:DeleteAccountPolicy permissions.

  • To delete a field index policy, you must have the logs:DeleteIndexPolicy and logs:DeleteAccountPolicy permissions.

If you delete a field index policy, the indexing of the log events that happened before you deleted the policy will still be used for up to 30 days to improve CloudWatch Logs Insights queries.

Parameter Syntax

$result = $client->deleteAccountPolicy([
    'policyName' => '<string>', // REQUIRED
    'policyType' => 'DATA_PROTECTION_POLICY|SUBSCRIPTION_FILTER_POLICY|FIELD_INDEX_POLICY|TRANSFORMER_POLICY', // REQUIRED
]);

Parameter Details

Members
policyName
Required: Yes
Type: string

The name of the policy to delete.

policyType
Required: Yes
Type: string

The type of policy to delete.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

DeleteDataProtectionPolicy

$result = $client->deleteDataProtectionPolicy([/* ... */]);
$promise = $client->deleteDataProtectionPolicyAsync([/* ... */]);

Deletes the data protection policy from the specified log group.

For more information about data protection policies, see PutDataProtectionPolicy.

Parameter Syntax

$result = $client->deleteDataProtectionPolicy([
    'logGroupIdentifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

The name or ARN of the log group that you want to delete the data protection policy for.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DeleteDelivery

$result = $client->deleteDelivery([/* ... */]);
$promise = $client->deleteDeliveryAsync([/* ... */]);

Deletes s delivery. A delivery is a connection between a logical delivery source and a logical delivery destination. Deleting a delivery only deletes the connection between the delivery source and delivery destination. It does not delete the delivery destination or the delivery source.

Parameter Syntax

$result = $client->deleteDelivery([
    'id' => '<string>', // REQUIRED
]);

Parameter Details

Members
id
Required: Yes
Type: string

The unique ID of the delivery to delete. You can find the ID of a delivery with the DescribeDeliveries operation.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ConflictException:

This operation attempted to create a resource that already exists.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

DeleteDeliveryDestination

$result = $client->deleteDeliveryDestination([/* ... */]);
$promise = $client->deleteDeliveryDestinationAsync([/* ... */]);

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

You can't delete a delivery destination if any current deliveries are associated with it. To find whether any deliveries are associated with this delivery destination, use the DescribeDeliveries operation and check the deliveryDestinationArn field in the results.

Parameter Syntax

$result = $client->deleteDeliveryDestination([
    'name' => '<string>', // REQUIRED
]);

Parameter Details

Members
name
Required: Yes
Type: string

The name of the delivery destination that you want to delete. You can find a list of delivery destionation names by using the DescribeDeliveryDestinations operation.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ConflictException:

This operation attempted to create a resource that already exists.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

DeleteDeliveryDestinationPolicy

$result = $client->deleteDeliveryDestinationPolicy([/* ... */]);
$promise = $client->deleteDeliveryDestinationPolicyAsync([/* ... */]);

Deletes a delivery destination policy. For more information about these policies, see PutDeliveryDestinationPolicy.

Parameter Syntax

$result = $client->deleteDeliveryDestinationPolicy([
    'deliveryDestinationName' => '<string>', // REQUIRED
]);

Parameter Details

Members
deliveryDestinationName
Required: Yes
Type: string

The name of the delivery destination that you want to delete the policy for.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

ResourceNotFoundException:

The specified resource does not exist.

ConflictException:

This operation attempted to create a resource that already exists.

DeleteDeliverySource

$result = $client->deleteDeliverySource([/* ... */]);
$promise = $client->deleteDeliverySourceAsync([/* ... */]);

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

You can't delete a delivery source if any current deliveries are associated with it. To find whether any deliveries are associated with this delivery source, use the DescribeDeliveries operation and check the deliverySourceName field in the results.

Parameter Syntax

$result = $client->deleteDeliverySource([
    'name' => '<string>', // REQUIRED
]);

Parameter Details

Members
name
Required: Yes
Type: string

The name of the delivery source that you want to delete.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ConflictException:

This operation attempted to create a resource that already exists.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

DeleteDestination

$result = $client->deleteDestination([/* ... */]);
$promise = $client->deleteDestinationAsync([/* ... */]);

Deletes the specified destination, and eventually disables all the subscription filters that publish to it. This operation does not delete the physical resource encapsulated by the destination.

Parameter Syntax

$result = $client->deleteDestination([
    'destinationName' => '<string>', // REQUIRED
]);

Parameter Details

Members
destinationName
Required: Yes
Type: string

The name of the destination.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DeleteIndexPolicy

$result = $client->deleteIndexPolicy([/* ... */]);
$promise = $client->deleteIndexPolicyAsync([/* ... */]);

Deletes a log-group level field index policy that was applied to a single log group. The indexing of the log events that happened before you delete the policy will still be used for as many as 30 days to improve CloudWatch Logs Insights queries.

You can't use this operation to delete an account-level index policy. Instead, use DeletAccountPolicy.

If you delete a log-group level field index policy and there is an account-level field index policy, in a few minutes the log group begins using that account-wide policy to index new incoming log events.

Parameter Syntax

$result = $client->deleteIndexPolicy([
    'logGroupIdentifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

The log group to delete the index policy for. You can specify either the name or the ARN of the log group.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DeleteIntegration

$result = $client->deleteIntegration([/* ... */]);
$promise = $client->deleteIntegrationAsync([/* ... */]);

Deletes the integration between CloudWatch Logs and OpenSearch Service. If your integration has active vended logs dashboards, you must specify true for the force parameter, otherwise the operation will fail. If you delete the integration by setting force to true, all your vended logs dashboards powered by OpenSearch Service will be deleted and the data that was on them will no longer be accessible.

Parameter Syntax

$result = $client->deleteIntegration([
    'force' => true || false,
    'integrationName' => '<string>', // REQUIRED
]);

Parameter Details

Members
force
Type: boolean

Specify true to force the deletion of the integration even if vended logs dashboards currently exist.

The default is false.

integrationName
Required: Yes
Type: string

The name of the integration to delete. To find the name of your integration, use ListIntegrations.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

DeleteLogAnomalyDetector

$result = $client->deleteLogAnomalyDetector([/* ... */]);
$promise = $client->deleteLogAnomalyDetectorAsync([/* ... */]);

Deletes the specified CloudWatch Logs anomaly detector.

Parameter Syntax

$result = $client->deleteLogAnomalyDetector([
    'anomalyDetectorArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
anomalyDetectorArn
Required: Yes
Type: string

The ARN of the anomaly detector to delete. You can find the ARNs of log anomaly detectors in your account by using the ListLogAnomalyDetectors operation.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

DeleteLogGroup

$result = $client->deleteLogGroup([/* ... */]);
$promise = $client->deleteLogGroupAsync([/* ... */]);

Deletes the specified log group and permanently deletes all the archived log events associated with the log group.

Parameter Syntax

$result = $client->deleteLogGroup([
    'logGroupName' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DeleteLogStream

$result = $client->deleteLogStream([/* ... */]);
$promise = $client->deleteLogStreamAsync([/* ... */]);

Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.

Parameter Syntax

$result = $client->deleteLogStream([
    'logGroupName' => '<string>', // REQUIRED
    'logStreamName' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

logStreamName
Required: Yes
Type: string

The name of the log stream.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DeleteMetricFilter

$result = $client->deleteMetricFilter([/* ... */]);
$promise = $client->deleteMetricFilterAsync([/* ... */]);

Deletes the specified metric filter.

Parameter Syntax

$result = $client->deleteMetricFilter([
    'filterName' => '<string>', // REQUIRED
    'logGroupName' => '<string>', // REQUIRED
]);

Parameter Details

Members
filterName
Required: Yes
Type: string

The name of the metric filter.

logGroupName
Required: Yes
Type: string

The name of the log group.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DeleteQueryDefinition

$result = $client->deleteQueryDefinition([/* ... */]);
$promise = $client->deleteQueryDefinitionAsync([/* ... */]);

Deletes a saved CloudWatch Logs Insights query definition. A query definition contains details about a saved CloudWatch Logs Insights query.

Each DeleteQueryDefinition operation can delete one query definition.

You must have the logs:DeleteQueryDefinition permission to be able to perform this operation.

Parameter Syntax

$result = $client->deleteQueryDefinition([
    'queryDefinitionId' => '<string>', // REQUIRED
]);

Parameter Details

Members
queryDefinitionId
Required: Yes
Type: string

The ID of the query definition that you want to delete. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.

Result Syntax

[
    'success' => true || false,
]

Result Details

Members
success
Type: boolean

A value of TRUE indicates that the operation succeeded. FALSE indicates that the operation failed.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DeleteResourcePolicy

$result = $client->deleteResourcePolicy([/* ... */]);
$promise = $client->deleteResourcePolicyAsync([/* ... */]);

Deletes a resource policy from this account. This revokes the access of the identities in that policy to put log events to this account.

Parameter Syntax

$result = $client->deleteResourcePolicy([
    'policyName' => '<string>',
]);

Parameter Details

Members
policyName
Type: string

The name of the policy to be revoked. This parameter is required.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DeleteRetentionPolicy

$result = $client->deleteRetentionPolicy([/* ... */]);
$promise = $client->deleteRetentionPolicyAsync([/* ... */]);

Deletes the specified retention policy.

Log events do not expire if they belong to log groups without a retention policy.

Parameter Syntax

$result = $client->deleteRetentionPolicy([
    'logGroupName' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DeleteSubscriptionFilter

$result = $client->deleteSubscriptionFilter([/* ... */]);
$promise = $client->deleteSubscriptionFilterAsync([/* ... */]);

Deletes the specified subscription filter.

Parameter Syntax

$result = $client->deleteSubscriptionFilter([
    'filterName' => '<string>', // REQUIRED
    'logGroupName' => '<string>', // REQUIRED
]);

Parameter Details

Members
filterName
Required: Yes
Type: string

The name of the subscription filter.

logGroupName
Required: Yes
Type: string

The name of the log group.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DeleteTransformer

$result = $client->deleteTransformer([/* ... */]);
$promise = $client->deleteTransformerAsync([/* ... */]);

Deletes the log transformer for the specified log group. As soon as you do this, the transformation of incoming log events according to that transformer stops. If this account has an account-level transformer that applies to this log group, the log group begins using that account-level transformer when this log-group level transformer is deleted.

After you delete a transformer, be sure to edit any metric filters or subscription filters that relied on the transformed versions of the log events.

Parameter Syntax

$result = $client->deleteTransformer([
    'logGroupIdentifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

Specify either the name or ARN of the log group to delete the transformer for. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

InvalidOperationException:

The operation is not valid on the specified resource.

DescribeAccountPolicies

$result = $client->describeAccountPolicies([/* ... */]);
$promise = $client->describeAccountPoliciesAsync([/* ... */]);

Returns a list of all CloudWatch Logs account policies in the account.

Parameter Syntax

$result = $client->describeAccountPolicies([
    'accountIdentifiers' => ['<string>', ...],
    'nextToken' => '<string>',
    'policyName' => '<string>',
    'policyType' => 'DATA_PROTECTION_POLICY|SUBSCRIPTION_FILTER_POLICY|FIELD_INDEX_POLICY|TRANSFORMER_POLICY', // REQUIRED
]);

Parameter Details

Members
accountIdentifiers
Type: Array of strings

If you are using an account that is set up as a monitoring account for CloudWatch unified cross-account observability, you can use this to specify the account ID of a source account. If you do, the operation returns the account policy for the specified account. Currently, you can specify only one account ID in this parameter.

If you omit this parameter, only the policy in the current account is returned.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

policyName
Type: string

Use this parameter to limit the returned policies to only the policy with the name that you specify.

policyType
Required: Yes
Type: string

Use this parameter to limit the returned policies to only the policies that match the policy type that you specify.

Result Syntax

[
    'accountPolicies' => [
        [
            'accountId' => '<string>',
            'lastUpdatedTime' => <integer>,
            'policyDocument' => '<string>',
            'policyName' => '<string>',
            'policyType' => 'DATA_PROTECTION_POLICY|SUBSCRIPTION_FILTER_POLICY|FIELD_INDEX_POLICY|TRANSFORMER_POLICY',
            'scope' => 'ALL',
            'selectionCriteria' => '<string>',
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
accountPolicies
Type: Array of AccountPolicy structures

An array of structures that contain information about the CloudWatch Logs account policies that match the specified filters.

nextToken
Type: string

The token to use when requesting the next set of items. The token expires after 24 hours.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DescribeConfigurationTemplates

$result = $client->describeConfigurationTemplates([/* ... */]);
$promise = $client->describeConfigurationTemplatesAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->describeConfigurationTemplates([
    'deliveryDestinationTypes' => ['<string>', ...],
    'limit' => <integer>,
    'logTypes' => ['<string>', ...],
    'nextToken' => '<string>',
    'resourceTypes' => ['<string>', ...],
    'service' => '<string>',
]);

Parameter Details

Members
deliveryDestinationTypes
Type: Array of strings

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

limit
Type: int

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

logTypes
Type: Array of strings

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

nextToken
Type: string

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

resourceTypes
Type: Array of strings

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

service
Type: string

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.

Result Syntax

[
    'configurationTemplates' => [
        [
            'allowedActionForAllowVendedLogsDeliveryForResource' => '<string>',
            'allowedFieldDelimiters' => ['<string>', ...],
            'allowedFields' => [
                [
                    'mandatory' => true || false,
                    'name' => '<string>',
                ],
                // ...
            ],
            'allowedOutputFormats' => ['<string>', ...],
            'allowedSuffixPathFields' => ['<string>', ...],
            'defaultDeliveryConfigValues' => [
                'fieldDelimiter' => '<string>',
                'recordFields' => ['<string>', ...],
                's3DeliveryConfiguration' => [
                    'enableHiveCompatiblePath' => true || false,
                    'suffixPath' => '<string>',
                ],
            ],
            'deliveryDestinationType' => 'S3|CWL|FH',
            'logType' => '<string>',
            'resourceType' => '<string>',
            'service' => '<string>',
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
configurationTemplates
Type: Array of ConfigurationTemplate structures

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

nextToken
Type: string

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

Errors

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

ResourceNotFoundException:

The specified resource does not exist.

ThrottlingException:

The request was throttled because of quota limits.

DescribeDeliveries

$result = $client->describeDeliveries([/* ... */]);
$promise = $client->describeDeliveriesAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->describeDeliveries([
    'limit' => <integer>,
    'nextToken' => '<string>',
]);

Parameter Details

Members
limit
Type: int

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

nextToken
Type: string

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

Result Syntax

[
    'deliveries' => [
        [
            'arn' => '<string>',
            'deliveryDestinationArn' => '<string>',
            'deliveryDestinationType' => 'S3|CWL|FH',
            'deliverySourceName' => '<string>',
            'fieldDelimiter' => '<string>',
            'id' => '<string>',
            'recordFields' => ['<string>', ...],
            's3DeliveryConfiguration' => [
                'enableHiveCompatiblePath' => true || false,
                'suffixPath' => '<string>',
            ],
            'tags' => ['<string>', ...],
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
deliveries
Type: Array of Delivery structures

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

nextToken
Type: string

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

Errors

ServiceUnavailableException:

The service cannot complete the request.

ServiceQuotaExceededException:

This request exceeds a service quota.

ValidationException:

One of the parameters for the request is not valid.

ThrottlingException:

The request was throttled because of quota limits.

DescribeDeliveryDestinations

$result = $client->describeDeliveryDestinations([/* ... */]);
$promise = $client->describeDeliveryDestinationsAsync([/* ... */]);

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

Parameter Syntax

$result = $client->describeDeliveryDestinations([
    'limit' => <integer>,
    'nextToken' => '<string>',
]);

Parameter Details

Members
limit
Type: int

Optionally specify the maximum number of delivery destinations to return in the response.

nextToken
Type: string

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

Result Syntax

[
    'deliveryDestinations' => [
        [
            'arn' => '<string>',
            'deliveryDestinationConfiguration' => [
                'destinationResourceArn' => '<string>',
            ],
            'deliveryDestinationType' => 'S3|CWL|FH',
            'name' => '<string>',
            'outputFormat' => 'json|plain|w3c|raw|parquet',
            'tags' => ['<string>', ...],
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
deliveryDestinations
Type: Array of DeliveryDestination structures

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

nextToken
Type: string

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

Errors

ServiceUnavailableException:

The service cannot complete the request.

ServiceQuotaExceededException:

This request exceeds a service quota.

ValidationException:

One of the parameters for the request is not valid.

ThrottlingException:

The request was throttled because of quota limits.

DescribeDeliverySources

$result = $client->describeDeliverySources([/* ... */]);
$promise = $client->describeDeliverySourcesAsync([/* ... */]);

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

Parameter Syntax

$result = $client->describeDeliverySources([
    'limit' => <integer>,
    'nextToken' => '<string>',
]);

Parameter Details

Members
limit
Type: int

Optionally specify the maximum number of delivery sources to return in the response.

nextToken
Type: string

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

Result Syntax

[
    'deliverySources' => [
        [
            'arn' => '<string>',
            'logType' => '<string>',
            'name' => '<string>',
            'resourceArns' => ['<string>', ...],
            'service' => '<string>',
            'tags' => ['<string>', ...],
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
deliverySources
Type: Array of DeliverySource structures

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

nextToken
Type: string

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

Errors

ServiceUnavailableException:

The service cannot complete the request.

ServiceQuotaExceededException:

This request exceeds a service quota.

ValidationException:

One of the parameters for the request is not valid.

ThrottlingException:

The request was throttled because of quota limits.

DescribeDestinations

$result = $client->describeDestinations([/* ... */]);
$promise = $client->describeDestinationsAsync([/* ... */]);

Lists all your destinations. The results are ASCII-sorted by destination name.

Parameter Syntax

$result = $client->describeDestinations([
    'DestinationNamePrefix' => '<string>',
    'limit' => <integer>,
    'nextToken' => '<string>',
]);

Parameter Details

Members
DestinationNamePrefix
Type: string

The prefix to match. If you don't specify a value, no prefix filter is applied.

limit
Type: int

The maximum number of items returned. If you don't specify a value, the default maximum value of 50 items is used.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

Result Syntax

[
    'destinations' => [
        [
            'accessPolicy' => '<string>',
            'arn' => '<string>',
            'creationTime' => <integer>,
            'destinationName' => '<string>',
            'roleArn' => '<string>',
            'targetArn' => '<string>',
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
destinations
Type: Array of Destination structures

The destinations.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

DescribeExportTasks

$result = $client->describeExportTasks([/* ... */]);
$promise = $client->describeExportTasksAsync([/* ... */]);

Lists the specified export tasks. You can list all your export tasks or filter the results based on task ID or task status.

Parameter Syntax

$result = $client->describeExportTasks([
    'limit' => <integer>,
    'nextToken' => '<string>',
    'statusCode' => 'CANCELLED|COMPLETED|FAILED|PENDING|PENDING_CANCEL|RUNNING',
    'taskId' => '<string>',
]);

Parameter Details

Members
limit
Type: int

The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

statusCode
Type: string

The status code of the export task. Specifying a status code filters the results to zero or more export tasks.

taskId
Type: string

The ID of the export task. Specifying a task ID filters the results to one or zero export tasks.

Result Syntax

[
    'exportTasks' => [
        [
            'destination' => '<string>',
            'destinationPrefix' => '<string>',
            'executionInfo' => [
                'completionTime' => <integer>,
                'creationTime' => <integer>,
            ],
            'from' => <integer>,
            'logGroupName' => '<string>',
            'status' => [
                'code' => 'CANCELLED|COMPLETED|FAILED|PENDING|PENDING_CANCEL|RUNNING',
                'message' => '<string>',
            ],
            'taskId' => '<string>',
            'taskName' => '<string>',
            'to' => <integer>,
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
exportTasks
Type: Array of ExportTask structures

The export tasks.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

DescribeFieldIndexes

$result = $client->describeFieldIndexes([/* ... */]);
$promise = $client->describeFieldIndexesAsync([/* ... */]);

Returns a list of field indexes listed in the field index policies of one or more log groups. For more information about field index policies, see PutIndexPolicy.

Parameter Syntax

$result = $client->describeFieldIndexes([
    'logGroupIdentifiers' => ['<string>', ...], // REQUIRED
    'nextToken' => '<string>',
]);

Parameter Details

Members
logGroupIdentifiers
Required: Yes
Type: Array of strings

An array containing the names or ARNs of the log groups that you want to retrieve field indexes for.

nextToken
Type: string

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

Result Syntax

[
    'fieldIndexes' => [
        [
            'fieldIndexName' => '<string>',
            'firstEventTime' => <integer>,
            'lastEventTime' => <integer>,
            'lastScanTime' => <integer>,
            'logGroupIdentifier' => '<string>',
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
fieldIndexes
Type: Array of FieldIndex structures

An array containing the field index information.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DescribeIndexPolicies

$result = $client->describeIndexPolicies([/* ... */]);
$promise = $client->describeIndexPoliciesAsync([/* ... */]);

Returns the field index policies of one or more log groups. For more information about field index policies, see PutIndexPolicy.

If a specified log group has a log-group level index policy, that policy is returned by this operation.

If a specified log group doesn't have a log-group level index policy, but an account-wide index policy applies to it, that account-wide policy is returned by this operation.

To find information about only account-level policies, use DescribeAccountPolicies instead.

Parameter Syntax

$result = $client->describeIndexPolicies([
    'logGroupIdentifiers' => ['<string>', ...], // REQUIRED
    'nextToken' => '<string>',
]);

Parameter Details

Members
logGroupIdentifiers
Required: Yes
Type: Array of strings

An array containing the name or ARN of the log group that you want to retrieve field index policies for.

nextToken
Type: string

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

Result Syntax

[
    'indexPolicies' => [
        [
            'lastUpdateTime' => <integer>,
            'logGroupIdentifier' => '<string>',
            'policyDocument' => '<string>',
            'policyName' => '<string>',
            'source' => 'ACCOUNT|LOG_GROUP',
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
indexPolicies
Type: Array of IndexPolicy structures

An array containing the field index policies.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

DescribeLogGroups

$result = $client->describeLogGroups([/* ... */]);
$promise = $client->describeLogGroupsAsync([/* ... */]);

Lists the specified log groups. You can list all your log groups or filter the results by prefix. The results are ASCII-sorted by log group name.

CloudWatch Logs doesn't support IAM policies that control access to the DescribeLogGroups action by using the aws:ResourceTag/key-name condition key. Other CloudWatch Logs actions do support the use of the aws:ResourceTag/key-name condition key to control access. For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.

Parameter Syntax

$result = $client->describeLogGroups([
    'accountIdentifiers' => ['<string>', ...],
    'includeLinkedAccounts' => true || false,
    'limit' => <integer>,
    'logGroupClass' => 'STANDARD|INFREQUENT_ACCESS',
    'logGroupNamePattern' => '<string>',
    'logGroupNamePrefix' => '<string>',
    'nextToken' => '<string>',
]);

Parameter Details

Members
accountIdentifiers
Type: Array of strings

When includeLinkedAccounts is set to True, use this parameter to specify the list of accounts to search. You can specify as many as 20 account IDs in the array.

includeLinkedAccounts
Type: boolean

If you are using a monitoring account, set this to True to have the operation return log groups in the accounts listed in accountIdentifiers.

If this parameter is set to true and accountIdentifiers contains a null value, the operation returns all log groups in the monitoring account and all log groups in all source accounts that are linked to the monitoring account.

limit
Type: int

The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

logGroupClass
Type: string

Specifies the log group class for this log group. There are two classes:

  • The Standard log class supports all CloudWatch Logs features.

  • The Infrequent Access log class supports a subset of CloudWatch Logs features and incurs lower costs.

For details about the features supported by each class, see Log classes

logGroupNamePattern
Type: string

If you specify a string for this parameter, the operation returns only log groups that have names that match the string based on a case-sensitive substring search. For example, if you specify Foo, log groups named FooBar, aws/Foo, and GroupFoo would match, but foo, F/o/o and Froo would not match.

If you specify logGroupNamePattern in your request, then only arn, creationTime, and logGroupName are included in the response.

logGroupNamePattern and logGroupNamePrefix are mutually exclusive. Only one of these parameters can be passed.

logGroupNamePrefix
Type: string

The prefix to match.

logGroupNamePrefix and logGroupNamePattern are mutually exclusive. Only one of these parameters can be passed.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

Result Syntax

[
    'logGroups' => [
        [
            'arn' => '<string>',
            'creationTime' => <integer>,
            'dataProtectionStatus' => 'ACTIVATED|DELETED|ARCHIVED|DISABLED',
            'inheritedProperties' => ['<string>', ...],
            'kmsKeyId' => '<string>',
            'logGroupArn' => '<string>',
            'logGroupClass' => 'STANDARD|INFREQUENT_ACCESS',
            'logGroupName' => '<string>',
            'metricFilterCount' => <integer>,
            'retentionInDays' => <integer>,
            'storedBytes' => <integer>,
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
logGroups
Type: Array of LogGroup structures

The log groups.

If the retentionInDays value is not included for a log group, then that log group's events do not expire.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

DescribeLogStreams

$result = $client->describeLogStreams([/* ... */]);
$promise = $client->describeLogStreamsAsync([/* ... */]);

Lists the log streams for the specified log group. You can list all the log streams or filter the results by prefix. You can also control how the results are ordered.

You can specify the log group to search by using either logGroupIdentifier or logGroupName. You must include one of these two parameters, but you can't include both.

This operation has a limit of five transactions per second, after which transactions are throttled.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.

Parameter Syntax

$result = $client->describeLogStreams([
    'descending' => true || false,
    'limit' => <integer>,
    'logGroupIdentifier' => '<string>',
    'logGroupName' => '<string>',
    'logStreamNamePrefix' => '<string>',
    'nextToken' => '<string>',
    'orderBy' => 'LogStreamName|LastEventTime',
]);

Parameter Details

Members
descending
Type: boolean

If the value is true, results are returned in descending order. If the value is to false, results are returned in ascending order. The default value is false.

limit
Type: int

The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

logGroupIdentifier
Type: string

Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN.

You must include either logGroupIdentifier or logGroupName, but not both.

logGroupName
Type: string

The name of the log group.

You must include either logGroupIdentifier or logGroupName, but not both.

logStreamNamePrefix
Type: string

The prefix to match.

If orderBy is LastEventTime, you cannot specify this parameter.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

orderBy
Type: string

If the value is LogStreamName, the results are ordered by log stream name. If the value is LastEventTime, the results are ordered by the event time. The default value is LogStreamName.

If you order the results by event time, you cannot specify the logStreamNamePrefix parameter.

lastEventTimestamp represents the time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. lastEventTimestamp updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.

Result Syntax

[
    'logStreams' => [
        [
            'arn' => '<string>',
            'creationTime' => <integer>,
            'firstEventTimestamp' => <integer>,
            'lastEventTimestamp' => <integer>,
            'lastIngestionTime' => <integer>,
            'logStreamName' => '<string>',
            'storedBytes' => <integer>,
            'uploadSequenceToken' => '<string>',
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
logStreams
Type: Array of LogStream structures

The log streams.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DescribeMetricFilters

$result = $client->describeMetricFilters([/* ... */]);
$promise = $client->describeMetricFiltersAsync([/* ... */]);

Lists the specified metric filters. You can list all of the metric filters or filter the results by log name, prefix, metric name, or metric namespace. The results are ASCII-sorted by filter name.

Parameter Syntax

$result = $client->describeMetricFilters([
    'filterNamePrefix' => '<string>',
    'limit' => <integer>,
    'logGroupName' => '<string>',
    'metricName' => '<string>',
    'metricNamespace' => '<string>',
    'nextToken' => '<string>',
]);

Parameter Details

Members
filterNamePrefix
Type: string

The prefix to match. CloudWatch Logs uses the value that you set here only if you also include the logGroupName parameter in your request.

limit
Type: int

The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

logGroupName
Type: string

The name of the log group.

metricName
Type: string

Filters results to include only those with the specified metric name. If you include this parameter in your request, you must also include the metricNamespace parameter.

metricNamespace
Type: string

Filters results to include only those in the specified namespace. If you include this parameter in your request, you must also include the metricName parameter.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

Result Syntax

[
    'metricFilters' => [
        [
            'applyOnTransformedLogs' => true || false,
            'creationTime' => <integer>,
            'filterName' => '<string>',
            'filterPattern' => '<string>',
            'logGroupName' => '<string>',
            'metricTransformations' => [
                [
                    'defaultValue' => <float>,
                    'dimensions' => ['<string>', ...],
                    'metricName' => '<string>',
                    'metricNamespace' => '<string>',
                    'metricValue' => '<string>',
                    'unit' => 'Seconds|Microseconds|Milliseconds|Bytes|Kilobytes|Megabytes|Gigabytes|Terabytes|Bits|Kilobits|Megabits|Gigabits|Terabits|Percent|Count|Bytes/Second|Kilobytes/Second|Megabytes/Second|Gigabytes/Second|Terabytes/Second|Bits/Second|Kilobits/Second|Megabits/Second|Gigabits/Second|Terabits/Second|Count/Second|None',
                ],
                // ...
            ],
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
metricFilters
Type: Array of MetricFilter structures

The metric filters.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DescribeQueries

$result = $client->describeQueries([/* ... */]);
$promise = $client->describeQueriesAsync([/* ... */]);

Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account. You can request all queries or limit it to queries of a specific log group or queries with a certain status.

Parameter Syntax

$result = $client->describeQueries([
    'logGroupName' => '<string>',
    'maxResults' => <integer>,
    'nextToken' => '<string>',
    'queryLanguage' => 'CWLI|SQL|PPL',
    'status' => 'Scheduled|Running|Complete|Failed|Cancelled|Timeout|Unknown',
]);

Parameter Details

Members
logGroupName
Type: string

Limits the returned queries to only those for the specified log group.

maxResults
Type: int

Limits the number of returned queries to the specified number.

nextToken
Type: string

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

queryLanguage
Type: string

Limits the returned queries to only the queries that use the specified query language.

status
Type: string

Limits the returned queries to only those that have the specified status. Valid values are Cancelled, Complete, Failed, Running, and Scheduled.

Result Syntax

[
    'nextToken' => '<string>',
    'queries' => [
        [
            'createTime' => <integer>,
            'logGroupName' => '<string>',
            'queryId' => '<string>',
            'queryLanguage' => 'CWLI|SQL|PPL',
            'queryString' => '<string>',
            'status' => 'Scheduled|Running|Complete|Failed|Cancelled|Timeout|Unknown',
        ],
        // ...
    ],
]

Result Details

Members
nextToken
Type: string

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

queries
Type: Array of QueryInfo structures

The list of queries that match the request.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DescribeQueryDefinitions

$result = $client->describeQueryDefinitions([/* ... */]);
$promise = $client->describeQueryDefinitionsAsync([/* ... */]);

This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can retrieve query definitions from the current account or from a source account that is linked to the current account.

You can use the queryDefinitionNamePrefix parameter to limit the results to only the query definitions that have names that start with a certain string.

Parameter Syntax

$result = $client->describeQueryDefinitions([
    'maxResults' => <integer>,
    'nextToken' => '<string>',
    'queryDefinitionNamePrefix' => '<string>',
    'queryLanguage' => 'CWLI|SQL|PPL',
]);

Parameter Details

Members
maxResults
Type: int

Limits the number of returned query definitions to the specified number.

nextToken
Type: string

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

queryDefinitionNamePrefix
Type: string

Use this parameter to filter your results to only the query definitions that have names that start with the prefix you specify.

queryLanguage
Type: string

The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

Result Syntax

[
    'nextToken' => '<string>',
    'queryDefinitions' => [
        [
            'lastModified' => <integer>,
            'logGroupNames' => ['<string>', ...],
            'name' => '<string>',
            'queryDefinitionId' => '<string>',
            'queryLanguage' => 'CWLI|SQL|PPL',
            'queryString' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
nextToken
Type: string

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

queryDefinitions
Type: Array of QueryDefinition structures

The list of query definitions that match your request.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

DescribeResourcePolicies

$result = $client->describeResourcePolicies([/* ... */]);
$promise = $client->describeResourcePoliciesAsync([/* ... */]);

Lists the resource policies in this account.

Parameter Syntax

$result = $client->describeResourcePolicies([
    'limit' => <integer>,
    'nextToken' => '<string>',
]);

Parameter Details

Members
limit
Type: int

The maximum number of resource policies to be displayed with one call of this API.

nextToken
Type: string

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

Result Syntax

[
    'nextToken' => '<string>',
    'resourcePolicies' => [
        [
            'lastUpdatedTime' => <integer>,
            'policyDocument' => '<string>',
            'policyName' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
nextToken
Type: string

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

resourcePolicies
Type: Array of ResourcePolicy structures

The resource policies that exist in this account.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

DescribeSubscriptionFilters

$result = $client->describeSubscriptionFilters([/* ... */]);
$promise = $client->describeSubscriptionFiltersAsync([/* ... */]);

Lists the subscription filters for the specified log group. You can list all the subscription filters or filter the results by prefix. The results are ASCII-sorted by filter name.

Parameter Syntax

$result = $client->describeSubscriptionFilters([
    'filterNamePrefix' => '<string>',
    'limit' => <integer>,
    'logGroupName' => '<string>', // REQUIRED
    'nextToken' => '<string>',
]);

Parameter Details

Members
filterNamePrefix
Type: string

The prefix to match. If you don't specify a value, no prefix filter is applied.

limit
Type: int

The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

logGroupName
Required: Yes
Type: string

The name of the log group.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

Result Syntax

[
    'nextToken' => '<string>',
    'subscriptionFilters' => [
        [
            'applyOnTransformedLogs' => true || false,
            'creationTime' => <integer>,
            'destinationArn' => '<string>',
            'distribution' => 'Random|ByLogStream',
            'filterName' => '<string>',
            'filterPattern' => '<string>',
            'logGroupName' => '<string>',
            'roleArn' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
nextToken
Type: string

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

subscriptionFilters
Type: Array of SubscriptionFilter structures

The subscription filters.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

DisassociateKmsKey

$result = $client->disassociateKmsKey([/* ... */]);
$promise = $client->disassociateKmsKeyAsync([/* ... */]);

Disassociates the specified KMS key from the specified log group or from all CloudWatch Logs Insights query results in the account.

When you use DisassociateKmsKey, you specify either the logGroupName parameter or the resourceIdentifier parameter. You can't specify both of those parameters in the same operation.

  • Specify the logGroupName parameter to stop using the KMS key to encrypt future log events ingested and stored in the log group. Instead, they will be encrypted with the default CloudWatch Logs method. The log events that were ingested while the key was associated with the log group are still encrypted with that key. Therefore, CloudWatch Logs will need permissions for the key whenever that data is accessed.

  • Specify the resourceIdentifier parameter with the query-result resource to stop using the KMS key to encrypt the results of all future StartQuery operations in the account. They will instead be encrypted with the default CloudWatch Logs method. The results from queries that ran while the key was associated with the account are still encrypted with that key. Therefore, CloudWatch Logs will need permissions for the key whenever that data is accessed.

It can take up to 5 minutes for this operation to take effect.

Parameter Syntax

$result = $client->disassociateKmsKey([
    'logGroupName' => '<string>',
    'resourceIdentifier' => '<string>',
]);

Parameter Details

Members
logGroupName
Type: string

The name of the log group.

In your DisassociateKmsKey operation, you must specify either the resourceIdentifier parameter or the logGroup parameter, but you can't specify both.

resourceIdentifier
Type: string

Specifies the target for this operation. You must specify one of the following:

  • Specify the ARN of a log group to stop having CloudWatch Logs use the KMS key to encrypt log events that are ingested and stored by that log group. After you run this operation, CloudWatch Logs encrypts ingested log events with the default CloudWatch Logs method. The log group ARN must be in the following format. Replace REGION and ACCOUNT_ID with your Region and account ID.

    arn:aws:logs:REGION:ACCOUNT_ID:log-group:LOG_GROUP_NAME

  • Specify the following ARN to stop using this key to encrypt the results of future StartQuery operations in this account. Replace REGION and ACCOUNT_ID with your Region and account ID.

    arn:aws:logs:REGION:ACCOUNT_ID:query-result:*

In your DisssociateKmsKey operation, you must specify either the resourceIdentifier parameter or the logGroup parameter, but you can't specify both.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

FilterLogEvents

$result = $client->filterLogEvents([/* ... */]);
$promise = $client->filterLogEventsAsync([/* ... */]);

Lists log events from the specified log group. You can list all the log events or filter the results using a filter pattern, a time range, and the name of the log stream.

You must have the logs:FilterLogEvents permission to perform this operation.

You can specify the log group to search by using either logGroupIdentifier or logGroupName. You must include one of these two parameters, but you can't include both.

By default, this operation returns as many log events as can fit in 1 MB (up to 10,000 log events) or all the events found within the specified time range. If the results include a token, that means there are more log events available. You can get additional results by specifying the token in a subsequent call. This operation can return empty results while there are more log events available through the token.

The returned log events are sorted by event timestamp, the timestamp when the event was ingested by CloudWatch Logs, and the ID of the PutLogEvents request.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.

Parameter Syntax

$result = $client->filterLogEvents([
    'endTime' => <integer>,
    'filterPattern' => '<string>',
    'interleaved' => true || false,
    'limit' => <integer>,
    'logGroupIdentifier' => '<string>',
    'logGroupName' => '<string>',
    'logStreamNamePrefix' => '<string>',
    'logStreamNames' => ['<string>', ...],
    'nextToken' => '<string>',
    'startTime' => <integer>,
    'unmask' => true || false,
]);

Parameter Details

Members
endTime
Type: long (int|float)

The end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not returned.

filterPattern
Type: string

The filter pattern to use. For more information, see Filter and Pattern Syntax.

If not provided, all the events are matched.

interleaved
Type: boolean

If the value is true, the operation attempts to provide responses that contain events from multiple log streams within the log group, interleaved in a single response. If the value is false, all the matched log events in the first log stream are searched first, then those in the next log stream, and so on.

Important As of June 17, 2019, this parameter is ignored and the value is assumed to be true. The response from this operation always interleaves events from multiple log streams within a log group.

limit
Type: int

The maximum number of events to return. The default is 10,000 events.

logGroupIdentifier
Type: string

Specify either the name or ARN of the log group to view log events from. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN.

You must include either logGroupIdentifier or logGroupName, but not both.

logGroupName
Type: string

The name of the log group to search.

You must include either logGroupIdentifier or logGroupName, but not both.

logStreamNamePrefix
Type: string

Filters the results to include only events from log streams that have names starting with this prefix.

If you specify a value for both logStreamNamePrefix and logStreamNames, the action returns an InvalidParameterException error.

logStreamNames
Type: Array of strings

Filters the results to only logs from the log streams in this list.

If you specify a value for both logStreamNames and logStreamNamePrefix, the action returns an InvalidParameterException error.

nextToken
Type: string

The token for the next set of events to return. (You received this token from a previous call.)

startTime
Type: long (int|float)

The start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not returned.

unmask
Type: boolean

Specify true to display the log event fields with all sensitive data unmasked and visible. The default is false.

To use this operation with this parameter, you must be signed into an account with the logs:Unmask permission.

Result Syntax

[
    'events' => [
        [
            'eventId' => '<string>',
            'ingestionTime' => <integer>,
            'logStreamName' => '<string>',
            'message' => '<string>',
            'timestamp' => <integer>,
        ],
        // ...
    ],
    'nextToken' => '<string>',
    'searchedLogStreams' => [
        [
            'logStreamName' => '<string>',
            'searchedCompletely' => true || false,
        ],
        // ...
    ],
]

Result Details

Members
events
Type: Array of FilteredLogEvent structures

The matched events.

nextToken
Type: string

The token to use when requesting the next set of items. The token expires after 24 hours.

searchedLogStreams
Type: Array of SearchedLogStream structures

Important As of May 15, 2020, this parameter is no longer supported. This parameter returns an empty list.

Indicates which log streams have been searched and whether each has been searched completely.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

GetDataProtectionPolicy

$result = $client->getDataProtectionPolicy([/* ... */]);
$promise = $client->getDataProtectionPolicyAsync([/* ... */]);

Returns information about a log group data protection policy.

Parameter Syntax

$result = $client->getDataProtectionPolicy([
    'logGroupIdentifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

The name or ARN of the log group that contains the data protection policy that you want to see.

Result Syntax

[
    'lastUpdatedTime' => <integer>,
    'logGroupIdentifier' => '<string>',
    'policyDocument' => '<string>',
]

Result Details

Members
lastUpdatedTime
Type: long (int|float)

The date and time that this policy was most recently updated.

logGroupIdentifier
Type: string

The log group name or ARN that you specified in your request.

policyDocument
Type: string

The data protection policy document for this log group.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

GetDelivery

$result = $client->getDelivery([/* ... */]);
$promise = $client->getDeliveryAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->getDelivery([
    'id' => '<string>', // REQUIRED
]);

Parameter Details

Members
id
Required: Yes
Type: string

The ID of the delivery that you want to retrieve.

Result Syntax

[
    'delivery' => [
        'arn' => '<string>',
        'deliveryDestinationArn' => '<string>',
        'deliveryDestinationType' => 'S3|CWL|FH',
        'deliverySourceName' => '<string>',
        'fieldDelimiter' => '<string>',
        'id' => '<string>',
        'recordFields' => ['<string>', ...],
        's3DeliveryConfiguration' => [
            'enableHiveCompatiblePath' => true || false,
            'suffixPath' => '<string>',
        ],
        'tags' => ['<string>', ...],
    ],
]

Result Details

Members
delivery
Type: Delivery structure

A structure that contains information about the delivery.

Errors

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

GetDeliveryDestination

$result = $client->getDeliveryDestination([/* ... */]);
$promise = $client->getDeliveryDestinationAsync([/* ... */]);

Retrieves complete information about one delivery destination.

Parameter Syntax

$result = $client->getDeliveryDestination([
    'name' => '<string>', // REQUIRED
]);

Parameter Details

Members
name
Required: Yes
Type: string

The name of the delivery destination that you want to retrieve.

Result Syntax

[
    'deliveryDestination' => [
        'arn' => '<string>',
        'deliveryDestinationConfiguration' => [
            'destinationResourceArn' => '<string>',
        ],
        'deliveryDestinationType' => 'S3|CWL|FH',
        'name' => '<string>',
        'outputFormat' => 'json|plain|w3c|raw|parquet',
        'tags' => ['<string>', ...],
    ],
]

Result Details

Members
deliveryDestination
Type: DeliveryDestination structure

A structure containing information about the delivery destination.

Errors

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

GetDeliveryDestinationPolicy

$result = $client->getDeliveryDestinationPolicy([/* ... */]);
$promise = $client->getDeliveryDestinationPolicyAsync([/* ... */]);

Retrieves the delivery destination policy assigned to the delivery destination that you specify. For more information about delivery destinations and their policies, see PutDeliveryDestinationPolicy.

Parameter Syntax

$result = $client->getDeliveryDestinationPolicy([
    'deliveryDestinationName' => '<string>', // REQUIRED
]);

Parameter Details

Members
deliveryDestinationName
Required: Yes
Type: string

The name of the delivery destination that you want to retrieve the policy of.

Result Syntax

[
    'policy' => [
        'deliveryDestinationPolicy' => '<string>',
    ],
]

Result Details

Members
policy
Type: Policy structure

The IAM policy for this delivery destination.

Errors

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

ResourceNotFoundException:

The specified resource does not exist.

GetDeliverySource

$result = $client->getDeliverySource([/* ... */]);
$promise = $client->getDeliverySourceAsync([/* ... */]);

Retrieves complete information about one delivery source.

Parameter Syntax

$result = $client->getDeliverySource([
    'name' => '<string>', // REQUIRED
]);

Parameter Details

Members
name
Required: Yes
Type: string

The name of the delivery source that you want to retrieve.

Result Syntax

[
    'deliverySource' => [
        'arn' => '<string>',
        'logType' => '<string>',
        'name' => '<string>',
        'resourceArns' => ['<string>', ...],
        'service' => '<string>',
        'tags' => ['<string>', ...],
    ],
]

Result Details

Members
deliverySource
Type: DeliverySource structure

A structure containing information about the delivery source.

Errors

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

GetIntegration

$result = $client->getIntegration([/* ... */]);
$promise = $client->getIntegrationAsync([/* ... */]);

Returns information about one integration between CloudWatch Logs and OpenSearch Service.

Parameter Syntax

$result = $client->getIntegration([
    'integrationName' => '<string>', // REQUIRED
]);

Parameter Details

Members
integrationName
Required: Yes
Type: string

The name of the integration that you want to find information about. To find the name of your integration, use ListIntegrations

Result Syntax

[
    'integrationDetails' => [
        'openSearchIntegrationDetails' => [
            'accessPolicy' => [
                'policyName' => '<string>',
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
            ],
            'application' => [
                'applicationArn' => '<string>',
                'applicationEndpoint' => '<string>',
                'applicationId' => '<string>',
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
            ],
            'collection' => [
                'collectionArn' => '<string>',
                'collectionEndpoint' => '<string>',
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
            ],
            'dataSource' => [
                'dataSourceName' => '<string>',
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
            ],
            'encryptionPolicy' => [
                'policyName' => '<string>',
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
            ],
            'lifecyclePolicy' => [
                'policyName' => '<string>',
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
            ],
            'networkPolicy' => [
                'policyName' => '<string>',
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
            ],
            'workspace' => [
                'status' => [
                    'status' => 'ACTIVE|NOT_FOUND|ERROR',
                    'statusMessage' => '<string>',
                ],
                'workspaceId' => '<string>',
            ],
        ],
    ],
    'integrationName' => '<string>',
    'integrationStatus' => 'PROVISIONING|ACTIVE|FAILED',
    'integrationType' => 'OPENSEARCH',
]

Result Details

Members
integrationDetails
Type: IntegrationDetails structure

A structure that contains information about the integration configuration. For an integration with OpenSearch Service, this includes information about OpenSearch Service resources such as the collection, the workspace, and policies.

integrationName
Type: string

The name of the integration.

integrationStatus
Type: string

The current status of this integration.

integrationType
Type: string

The type of integration. Integrations with OpenSearch Service have the type OPENSEARCH.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

ResourceNotFoundException:

The specified resource does not exist.

GetLogAnomalyDetector

$result = $client->getLogAnomalyDetector([/* ... */]);
$promise = $client->getLogAnomalyDetectorAsync([/* ... */]);

Retrieves information about the log anomaly detector that you specify.

Parameter Syntax

$result = $client->getLogAnomalyDetector([
    'anomalyDetectorArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
anomalyDetectorArn
Required: Yes
Type: string

The ARN of the anomaly detector to retrieve information about. You can find the ARNs of log anomaly detectors in your account by using the ListLogAnomalyDetectors operation.

Result Syntax

[
    'anomalyDetectorStatus' => 'INITIALIZING|TRAINING|ANALYZING|FAILED|DELETED|PAUSED',
    'anomalyVisibilityTime' => <integer>,
    'creationTimeStamp' => <integer>,
    'detectorName' => '<string>',
    'evaluationFrequency' => 'ONE_MIN|FIVE_MIN|TEN_MIN|FIFTEEN_MIN|THIRTY_MIN|ONE_HOUR',
    'filterPattern' => '<string>',
    'kmsKeyId' => '<string>',
    'lastModifiedTimeStamp' => <integer>,
    'logGroupArnList' => ['<string>', ...],
]

Result Details

Members
anomalyDetectorStatus
Type: string

Specifies whether the anomaly detector is currently active. To change its status, use the enabled parameter in the UpdateLogAnomalyDetector operation.

anomalyVisibilityTime
Type: long (int|float)

The number of days used as the life cycle of anomalies. After this time, anomalies are automatically baselined and the anomaly detector model will treat new occurrences of similar event as normal.

creationTimeStamp
Type: long (int|float)

The date and time when this anomaly detector was created.

detectorName
Type: string

The name of the log anomaly detector

evaluationFrequency
Type: string

Specifies how often the anomaly detector runs and look for anomalies. Set this value according to the frequency that the log group receives new logs. For example, if the log group receives new log events every 10 minutes, then setting evaluationFrequency to FIFTEEN_MIN might be appropriate.

filterPattern
Type: string

A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

kmsKeyId
Type: string

The ID of the KMS key assigned to this anomaly detector, if any.

lastModifiedTimeStamp
Type: long (int|float)

The date and time when this anomaly detector was most recently modified.

logGroupArnList
Type: Array of strings

An array of structures, where each structure contains the ARN of a log group associated with this anomaly detector.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

GetLogEvents

$result = $client->getLogEvents([/* ... */]);
$promise = $client->getLogEventsAsync([/* ... */]);

Lists log events from the specified log stream. You can list all of the log events or filter using a time range.

By default, this operation returns as many log events as can fit in a response size of 1MB (up to 10,000 log events). You can get additional log events by specifying one of the tokens in a subsequent call. This operation can return empty results while there are more log events available through the token.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.

You can specify the log group to search by using either logGroupIdentifier or logGroupName. You must include one of these two parameters, but you can't include both.

Parameter Syntax

$result = $client->getLogEvents([
    'endTime' => <integer>,
    'limit' => <integer>,
    'logGroupIdentifier' => '<string>',
    'logGroupName' => '<string>',
    'logStreamName' => '<string>', // REQUIRED
    'nextToken' => '<string>',
    'startFromHead' => true || false,
    'startTime' => <integer>,
    'unmask' => true || false,
]);

Parameter Details

Members
endTime
Type: long (int|float)

The end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to or later than this time are not included.

limit
Type: int

The maximum number of log events returned. If you don't specify a limit, the default is as many log events as can fit in a response size of 1 MB (up to 10,000 log events).

logGroupIdentifier
Type: string

Specify either the name or ARN of the log group to view events from. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN.

You must include either logGroupIdentifier or logGroupName, but not both.

logGroupName
Type: string

The name of the log group.

You must include either logGroupIdentifier or logGroupName, but not both.

logStreamName
Required: Yes
Type: string

The name of the log stream.

nextToken
Type: string

The token for the next set of items to return. (You received this token from a previous call.)

startFromHead
Type: boolean

If the value is true, the earliest log events are returned first. If the value is false, the latest log events are returned first. The default value is false.

If you are using a previous nextForwardToken value as the nextToken in this operation, you must specify true for startFromHead.

startTime
Type: long (int|float)

The start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to this time or later than this time are included. Events with a timestamp earlier than this time are not included.

unmask
Type: boolean

Specify true to display the log event fields with all sensitive data unmasked and visible. The default is false.

To use this operation with this parameter, you must be signed into an account with the logs:Unmask permission.

Result Syntax

[
    'events' => [
        [
            'ingestionTime' => <integer>,
            'message' => '<string>',
            'timestamp' => <integer>,
        ],
        // ...
    ],
    'nextBackwardToken' => '<string>',
    'nextForwardToken' => '<string>',
]

Result Details

Members
events
Type: Array of OutputLogEvent structures

The events.

nextBackwardToken
Type: string

The token for the next set of items in the backward direction. The token expires after 24 hours. This token is not null. If you have reached the end of the stream, it returns the same token you passed in.

nextForwardToken
Type: string

The token for the next set of items in the forward direction. The token expires after 24 hours. If you have reached the end of the stream, it returns the same token you passed in.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

GetLogGroupFields

$result = $client->getLogGroupFields([/* ... */]);
$promise = $client->getLogGroupFieldsAsync([/* ... */]);

Returns a list of the fields that are included in log events in the specified log group. Includes the percentage of log events that contain each field. The search is limited to a time period that you specify.

You can specify the log group to search by using either logGroupIdentifier or logGroupName. You must specify one of these parameters, but you can't specify both.

In the results, fields that start with @ are fields generated by CloudWatch Logs. For example, @timestamp is the timestamp of each log event. For more information about the fields that are generated by CloudWatch logs, see Supported Logs and Discovered Fields.

The response results are sorted by the frequency percentage, starting with the highest percentage.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.

Parameter Syntax

$result = $client->getLogGroupFields([
    'logGroupIdentifier' => '<string>',
    'logGroupName' => '<string>',
    'time' => <integer>,
]);

Parameter Details

Members
logGroupIdentifier
Type: string

Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must specify the ARN.

You must include either logGroupIdentifier or logGroupName, but not both.

logGroupName
Type: string

The name of the log group to search.

You must include either logGroupIdentifier or logGroupName, but not both.

time
Type: long (int|float)

The time to set as the center of the query. If you specify time, the 8 minutes before and 8 minutes after this time are searched. If you omit time, the most recent 15 minutes up to the current time are searched.

The time value is specified as epoch time, which is the number of seconds since January 1, 1970, 00:00:00 UTC.

Result Syntax

[
    'logGroupFields' => [
        [
            'name' => '<string>',
            'percent' => <integer>,
        ],
        // ...
    ],
]

Result Details

Members
logGroupFields
Type: Array of LogGroupField structures

The array of fields found in the query. Each object in the array contains the name of the field, along with the percentage of time it appeared in the log events that were queried.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

GetLogRecord

$result = $client->getLogRecord([/* ... */]);
$promise = $client->getLogRecordAsync([/* ... */]);

Retrieves all of the fields and values of a single log event. All fields are retrieved, even if the original query that produced the logRecordPointer retrieved only a subset of fields. Fields are returned as field name/field value pairs.

The full unparsed log event is returned within @message.

Parameter Syntax

$result = $client->getLogRecord([
    'logRecordPointer' => '<string>', // REQUIRED
    'unmask' => true || false,
]);

Parameter Details

Members
logRecordPointer
Required: Yes
Type: string

The pointer corresponding to the log event record you want to retrieve. You get this from the response of a GetQueryResults operation. In that response, the value of the @ptr field for a log event is the value to use as logRecordPointer to retrieve that complete log event record.

unmask
Type: boolean

Specify true to display the log event fields with all sensitive data unmasked and visible. The default is false.

To use this operation with this parameter, you must be signed into an account with the logs:Unmask permission.

Result Syntax

[
    'logRecord' => ['<string>', ...],
]

Result Details

Members
logRecord
Type: Associative array of custom strings keys (Field) to strings

The requested log event, as a JSON string.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

GetQueryResults

$result = $client->getQueryResults([/* ... */]);
$promise = $client->getQueryResultsAsync([/* ... */]);

Returns the results from the specified query.

Only the fields requested in the query are returned, along with a @ptr field, which is the identifier for the log record. You can use the value of @ptr in a GetLogRecord operation to get the full log record.

GetQueryResults does not start running a query. To run a query, use StartQuery. For more information about how long results of previous queries are available, see CloudWatch Logs quotas.

If the value of the Status field in the output is Running, this operation returns only partial results. If you see a value of Scheduled or Running for the status, you can retry the operation later to see the final results.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account to start queries in linked source accounts. For more information, see CloudWatch cross-account observability.

Parameter Syntax

$result = $client->getQueryResults([
    'queryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
queryId
Required: Yes
Type: string

The ID number of the query.

Result Syntax

[
    'encryptionKey' => '<string>',
    'queryLanguage' => 'CWLI|SQL|PPL',
    'results' => [
        [
            [
                'field' => '<string>',
                'value' => '<string>',
            ],
            // ...
        ],
        // ...
    ],
    'statistics' => [
        'bytesScanned' => <float>,
        'estimatedBytesSkipped' => <float>,
        'estimatedRecordsSkipped' => <float>,
        'logGroupsScanned' => <float>,
        'recordsMatched' => <float>,
        'recordsScanned' => <float>,
    ],
    'status' => 'Scheduled|Running|Complete|Failed|Cancelled|Timeout|Unknown',
]

Result Details

Members
encryptionKey
Type: string

If you associated an KMS key with the CloudWatch Logs Insights query results in this account, this field displays the ARN of the key that's used to encrypt the query results when StartQuery stores them.

queryLanguage
Type: string

The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

results
Type: Array of ResultField structuress

The log events that matched the query criteria during the most recent time it ran.

The results value is an array of arrays. Each log event is one object in the top-level array. Each of these log event objects is an array of field/value pairs.

statistics
Type: QueryStatistics structure

Includes the number of log events scanned by the query, the number of log events that matched the query criteria, and the total number of bytes in the scanned log events. These values reflect the full raw results of the query.

status
Type: string

The status of the most recent running of the query. Possible values are Cancelled, Complete, Failed, Running, Scheduled, Timeout, and Unknown.

Queries time out after 60 minutes of runtime. To avoid having your queries time out, reduce the time range being searched or partition your query into a number of queries.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

GetTransformer

$result = $client->getTransformer([/* ... */]);
$promise = $client->getTransformerAsync([/* ... */]);

Returns the information about the log transformer associated with this log group.

This operation returns data only for transformers created at the log group level. To get information for an account-level transformer, use DescribeAccountPolicies.

Parameter Syntax

$result = $client->getTransformer([
    'logGroupIdentifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

Specify either the name or ARN of the log group to return transformer information for. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN.

Result Syntax

[
    'creationTime' => <integer>,
    'lastModifiedTime' => <integer>,
    'logGroupIdentifier' => '<string>',
    'transformerConfig' => [
        [
            'addKeys' => [
                'entries' => [
                    [
                        'key' => '<string>',
                        'overwriteIfExists' => true || false,
                        'value' => '<string>',
                    ],
                    // ...
                ],
            ],
            'copyValue' => [
                'entries' => [
                    [
                        'overwriteIfExists' => true || false,
                        'source' => '<string>',
                        'target' => '<string>',
                    ],
                    // ...
                ],
            ],
            'csv' => [
                'columns' => ['<string>', ...],
                'delimiter' => '<string>',
                'quoteCharacter' => '<string>',
                'source' => '<string>',
            ],
            'dateTimeConverter' => [
                'locale' => '<string>',
                'matchPatterns' => ['<string>', ...],
                'source' => '<string>',
                'sourceTimezone' => '<string>',
                'target' => '<string>',
                'targetFormat' => '<string>',
                'targetTimezone' => '<string>',
            ],
            'deleteKeys' => [
                'withKeys' => ['<string>', ...],
            ],
            'grok' => [
                'match' => '<string>',
                'source' => '<string>',
            ],
            'listToMap' => [
                'flatten' => true || false,
                'flattenedElement' => 'first|last',
                'key' => '<string>',
                'source' => '<string>',
                'target' => '<string>',
                'valueKey' => '<string>',
            ],
            'lowerCaseString' => [
                'withKeys' => ['<string>', ...],
            ],
            'moveKeys' => [
                'entries' => [
                    [
                        'overwriteIfExists' => true || false,
                        'source' => '<string>',
                        'target' => '<string>',
                    ],
                    // ...
                ],
            ],
            'parseCloudfront' => [
                'source' => '<string>',
            ],
            'parseJSON' => [
                'destination' => '<string>',
                'source' => '<string>',
            ],
            'parseKeyValue' => [
                'destination' => '<string>',
                'fieldDelimiter' => '<string>',
                'keyPrefix' => '<string>',
                'keyValueDelimiter' => '<string>',
                'nonMatchValue' => '<string>',
                'overwriteIfExists' => true || false,
                'source' => '<string>',
            ],
            'parsePostgres' => [
                'source' => '<string>',
            ],
            'parseRoute53' => [
                'source' => '<string>',
            ],
            'parseVPC' => [
                'source' => '<string>',
            ],
            'parseWAF' => [
                'source' => '<string>',
            ],
            'renameKeys' => [
                'entries' => [
                    [
                        'key' => '<string>',
                        'overwriteIfExists' => true || false,
                        'renameTo' => '<string>',
                    ],
                    // ...
                ],
            ],
            'splitString' => [
                'entries' => [
                    [
                        'delimiter' => '<string>',
                        'source' => '<string>',
                    ],
                    // ...
                ],
            ],
            'substituteString' => [
                'entries' => [
                    [
                        'from' => '<string>',
                        'source' => '<string>',
                        'to' => '<string>',
                    ],
                    // ...
                ],
            ],
            'trimString' => [
                'withKeys' => ['<string>', ...],
            ],
            'typeConverter' => [
                'entries' => [
                    [
                        'key' => '<string>',
                        'type' => 'boolean|integer|double|string',
                    ],
                    // ...
                ],
            ],
            'upperCaseString' => [
                'withKeys' => ['<string>', ...],
            ],
        ],
        // ...
    ],
]

Result Details

Members
creationTime
Type: long (int|float)

The creation time of the transformer, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

lastModifiedTime
Type: long (int|float)

The date and time when this transformer was most recently modified, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

logGroupIdentifier
Type: string

The ARN of the log group that you specified in your request.

transformerConfig
Type: Array of Processor structures

This sructure contains the configuration of the requested transformer.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

InvalidOperationException:

The operation is not valid on the specified resource.

ListAnomalies

$result = $client->listAnomalies([/* ... */]);
$promise = $client->listAnomaliesAsync([/* ... */]);

Returns a list of anomalies that log anomaly detectors have found. For details about the structure format of each anomaly object that is returned, see the example in this section.

Parameter Syntax

$result = $client->listAnomalies([
    'anomalyDetectorArn' => '<string>',
    'limit' => <integer>,
    'nextToken' => '<string>',
    'suppressionState' => 'SUPPRESSED|UNSUPPRESSED',
]);

Parameter Details

Members
anomalyDetectorArn
Type: string

Use this to optionally limit the results to only the anomalies found by a certain anomaly detector.

limit
Type: int

The maximum number of items to return. If you don't specify a value, the default maximum value of 50 items is used.

nextToken
Type: string

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

suppressionState
Type: string

You can specify this parameter if you want to the operation to return only anomalies that are currently either suppressed or unsuppressed.

Result Syntax

[
    'anomalies' => [
        [
            'active' => true || false,
            'anomalyDetectorArn' => '<string>',
            'anomalyId' => '<string>',
            'description' => '<string>',
            'firstSeen' => <integer>,
            'histogram' => [<integer>, ...],
            'isPatternLevelSuppression' => true || false,
            'lastSeen' => <integer>,
            'logGroupArnList' => ['<string>', ...],
            'logSamples' => [
                [
                    'message' => '<string>',
                    'timestamp' => <integer>,
                ],
                // ...
            ],
            'patternId' => '<string>',
            'patternRegex' => '<string>',
            'patternString' => '<string>',
            'patternTokens' => [
                [
                    'dynamicTokenPosition' => <integer>,
                    'enumerations' => [<integer>, ...],
                    'inferredTokenName' => '<string>',
                    'isDynamic' => true || false,
                    'tokenString' => '<string>',
                ],
                // ...
            ],
            'priority' => '<string>',
            'state' => 'Active|Suppressed|Baseline',
            'suppressed' => true || false,
            'suppressedDate' => <integer>,
            'suppressedUntil' => <integer>,
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
anomalies
Type: Array of Anomaly structures

An array of structures, where each structure contains information about one anomaly that a log anomaly detector has found.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ListIntegrations

$result = $client->listIntegrations([/* ... */]);
$promise = $client->listIntegrationsAsync([/* ... */]);

Returns a list of integrations between CloudWatch Logs and other services in this account. Currently, only one integration can be created in an account, and this integration must be with OpenSearch Service.

Parameter Syntax

$result = $client->listIntegrations([
    'integrationNamePrefix' => '<string>',
    'integrationStatus' => 'PROVISIONING|ACTIVE|FAILED',
    'integrationType' => 'OPENSEARCH',
]);

Parameter Details

Members
integrationNamePrefix
Type: string

To limit the results to integrations that start with a certain name prefix, specify that name prefix here.

integrationStatus
Type: string

To limit the results to integrations with a certain status, specify that status here.

integrationType
Type: string

To limit the results to integrations of a certain type, specify that type here.

Result Syntax

[
    'integrationSummaries' => [
        [
            'integrationName' => '<string>',
            'integrationStatus' => 'PROVISIONING|ACTIVE|FAILED',
            'integrationType' => 'OPENSEARCH',
        ],
        // ...
    ],
]

Result Details

Members
integrationSummaries
Type: Array of IntegrationSummary structures

An array, where each object in the array contains information about one CloudWatch Logs integration in this account.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

ListLogAnomalyDetectors

$result = $client->listLogAnomalyDetectors([/* ... */]);
$promise = $client->listLogAnomalyDetectorsAsync([/* ... */]);

Retrieves a list of the log anomaly detectors in the account.

Parameter Syntax

$result = $client->listLogAnomalyDetectors([
    'filterLogGroupArn' => '<string>',
    'limit' => <integer>,
    'nextToken' => '<string>',
]);

Parameter Details

Members
filterLogGroupArn
Type: string

Use this to optionally filter the results to only include anomaly detectors that are associated with the specified log group.

limit
Type: int

The maximum number of items to return. If you don't specify a value, the default maximum value of 50 items is used.

nextToken
Type: string

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

Result Syntax

[
    'anomalyDetectors' => [
        [
            'anomalyDetectorArn' => '<string>',
            'anomalyDetectorStatus' => 'INITIALIZING|TRAINING|ANALYZING|FAILED|DELETED|PAUSED',
            'anomalyVisibilityTime' => <integer>,
            'creationTimeStamp' => <integer>,
            'detectorName' => '<string>',
            'evaluationFrequency' => 'ONE_MIN|FIVE_MIN|TEN_MIN|FIFTEEN_MIN|THIRTY_MIN|ONE_HOUR',
            'filterPattern' => '<string>',
            'kmsKeyId' => '<string>',
            'lastModifiedTimeStamp' => <integer>,
            'logGroupArnList' => ['<string>', ...],
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
anomalyDetectors
Type: Array of AnomalyDetector structures

An array of structures, where each structure in the array contains information about one anomaly detector.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ListLogGroupsForQuery

$result = $client->listLogGroupsForQuery([/* ... */]);
$promise = $client->listLogGroupsForQueryAsync([/* ... */]);

Returns a list of the log groups that were analyzed during a single CloudWatch Logs Insights query. This can be useful for queries that use log group name prefixes or the filterIndex command, because the log groups are dynamically selected in these cases.

For more information about field indexes, see Create field indexes to improve query performance and reduce costs.

Parameter Syntax

$result = $client->listLogGroupsForQuery([
    'maxResults' => <integer>,
    'nextToken' => '<string>',
    'queryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
maxResults
Type: int

Limits the number of returned log groups to the specified number.

nextToken
Type: string

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

queryId
Required: Yes
Type: string

The ID of the query to use. This query ID is from the response to your StartQuery operation.

Result Syntax

[
    'logGroupIdentifiers' => ['<string>', ...],
    'nextToken' => '<string>',
]

Result Details

Members
logGroupIdentifiers
Type: Array of strings

An array of the names and ARNs of the log groups that were processed in the query.

nextToken
Type: string

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

Errors

InvalidParameterException:

A parameter is specified incorrectly.

AccessDeniedException:

You don't have sufficient permissions to perform this action.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ListTagsForResource

$result = $client->listTagsForResource([/* ... */]);
$promise = $client->listTagsForResourceAsync([/* ... */]);

Displays the tags associated with a CloudWatch Logs resource. Currently, log groups and destinations support tagging.

Parameter Syntax

$result = $client->listTagsForResource([
    'resourceArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
resourceArn
Required: Yes
Type: string

The ARN of the resource that you want to view tags for.

The ARN format of a log group is arn:aws:logs:Region:account-id:log-group:log-group-name

The ARN format of a destination is arn:aws:logs:Region:account-id:destination:destination-name

For more information about ARN format, see CloudWatch Logs resources and operations.

Result Syntax

[
    'tags' => ['<string>', ...],
]

Result Details

Members
tags
Type: Associative array of custom strings keys (TagKey) to strings

The list of tags associated with the requested resource.>

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

ListTagsLogGroup

$result = $client->listTagsLogGroup([/* ... */]);
$promise = $client->listTagsLogGroupAsync([/* ... */]);

The ListTagsLogGroup operation is on the path to deprecation. We recommend that you use ListTagsForResource instead.

Lists the tags for the specified log group.

Parameter Syntax

$result = $client->listTagsLogGroup([
    'logGroupName' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

Result Syntax

[
    'tags' => ['<string>', ...],
]

Result Details

Members
tags
Type: Associative array of custom strings keys (TagKey) to strings

The tags for the log group.

Errors

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

PutAccountPolicy

$result = $client->putAccountPolicy([/* ... */]);
$promise = $client->putAccountPolicyAsync([/* ... */]);

Creates an account-level data protection policy, subscription filter policy, or field index policy that applies to all log groups or a subset of log groups in the account.

Data protection policy

A data protection policy can help safeguard sensitive data that's ingested by your log groups by auditing and masking the sensitive log data. Each account can have only one account-level data protection policy.

Sensitive data is detected and masked when it is ingested into a log group. When you set a data protection policy, log events ingested into the log groups before that time are not masked.

If you use PutAccountPolicy to create a data protection policy for your whole account, it applies to both existing log groups and all log groups that are created later in this account. The account-level policy is applied to existing log groups with eventual consistency. It might take up to 5 minutes before sensitive data in existing log groups begins to be masked.

By default, when a user views a log event that includes masked data, the sensitive data is replaced by asterisks. A user who has the logs:Unmask permission can use a GetLogEvents or FilterLogEvents operation with the unmask parameter set to true to view the unmasked log events. Users with the logs:Unmask can also view unmasked data in the CloudWatch Logs console by running a CloudWatch Logs Insights query with the unmask query command.

For more information, including a list of types of data that can be audited and masked, see Protect sensitive log data with masking.

To use the PutAccountPolicy operation for a data protection policy, you must be signed on with the logs:PutDataProtectionPolicy and logs:PutAccountPolicy permissions.

The PutAccountPolicy operation applies to all log groups in the account. You can use PutDataProtectionPolicy to create a data protection policy that applies to just one log group. If a log group has its own data protection policy and the account also has an account-level data protection policy, then the two policies are cumulative. Any sensitive term specified in either policy is masked.

Subscription filter policy

A subscription filter policy sets up a real-time feed of log events from CloudWatch Logs to other Amazon Web Services services. Account-level subscription filter policies apply to both existing log groups and log groups that are created later in this account. Supported destinations are Kinesis Data Streams, Firehose, and Lambda. When log events are sent to the receiving service, they are Base64 encoded and compressed with the GZIP format.

The following destinations are supported for subscription filters:

  • An Kinesis Data Streams data stream in the same account as the subscription policy, for same-account delivery.

  • An Firehose data stream in the same account as the subscription policy, for same-account delivery.

  • A Lambda function in the same account as the subscription policy, for same-account delivery.

  • A logical destination in a different account created with PutDestination, for cross-account delivery. Kinesis Data Streams and Firehose are supported as logical destinations.

Each account can have one account-level subscription filter policy per Region. If you are updating an existing filter, you must specify the correct name in PolicyName. To perform a PutAccountPolicy subscription filter operation for any destination except a Lambda function, you must also have the iam:PassRole permission.

Transformer policy

Creates or updates a log transformer policy for your account. You use log transformers to transform log events into a different format, making them easier for you to process and analyze. You can also transform logs from different sources into standardized formats that contain relevant, source-specific information. After you have created a transformer, CloudWatch Logs performs this transformation at the time of log ingestion. You can then refer to the transformed versions of the logs during operations such as querying with CloudWatch Logs Insights or creating metric filters or subscription filters.

You can also use a transformer to copy metadata from metadata keys into the log events themselves. This metadata can include log group name, log stream name, account ID and Region.

A transformer for a log group is a series of processors, where each processor applies one type of transformation to the log events ingested into this log group. For more information about the available processors to use in a transformer, see Processors that you can use.

Having log events in standardized format enables visibility across your applications for your log analysis, reporting, and alarming needs. CloudWatch Logs provides transformation for common log types with out-of-the-box transformation templates for major Amazon Web Services log sources such as VPC flow logs, Lambda, and Amazon RDS. You can use pre-built transformation templates or create custom transformation policies.

You can create transformers only for the log groups in the Standard log class.

You can have one account-level transformer policy that applies to all log groups in the account. Or you can create as many as 20 account-level transformer policies that are each scoped to a subset of log groups with the selectionCriteria parameter. If you have multiple account-level transformer policies with selection criteria, no two of them can use the same or overlapping log group name prefixes. For example, if you have one policy filtered to log groups that start with my-log, you can't have another field index policy filtered to my-logpprod or my-logging.

You can also set up a transformer at the log-group level. For more information, see PutTransformer. If there is both a log-group level transformer created with PutTransformer and an account-level transformer that could apply to the same log group, the log group uses only the log-group level transformer. It ignores the account-level transformer.

Field index policy

You can use field index policies to create indexes on fields found in log events in the log group. Creating field indexes can help lower the scan volume for CloudWatch Logs Insights queries that reference those fields, because these queries attempt to skip the processing of log events that are known to not match the indexed field. Good fields to index are fields that you often need to query for and fields or values that match only a small fraction of the total log events. Common examples of indexes include request ID, session ID, user IDs, or instance IDs. For more information, see Create field indexes to improve query performance and reduce costs

To find the fields that are in your log group events, use the GetLogGroupFields operation.

For example, suppose you have created a field index for requestId. Then, any CloudWatch Logs Insights query on that log group that includes requestId = value or requestId in [value, value, ...] will attempt to process only the log events where the indexed field matches the specified value.

Matches of log events to the names of indexed fields are case-sensitive. For example, an indexed field of RequestId won't match a log event containing requestId.

You can have one account-level field index policy that applies to all log groups in the account. Or you can create as many as 20 account-level field index policies that are each scoped to a subset of log groups with the selectionCriteria parameter. If you have multiple account-level index policies with selection criteria, no two of them can use the same or overlapping log group name prefixes. For example, if you have one policy filtered to log groups that start with my-log, you can't have another field index policy filtered to my-logpprod or my-logging.

If you create an account-level field index policy in a monitoring account in cross-account observability, the policy is applied only to the monitoring account and not to any source accounts.

If you want to create a field index policy for a single log group, you can use PutIndexPolicy instead of PutAccountPolicy. If you do so, that log group will use only that log-group level policy, and will ignore the account-level policy that you create with PutAccountPolicy.

Parameter Syntax

$result = $client->putAccountPolicy([
    'policyDocument' => '<string>', // REQUIRED
    'policyName' => '<string>', // REQUIRED
    'policyType' => 'DATA_PROTECTION_POLICY|SUBSCRIPTION_FILTER_POLICY|FIELD_INDEX_POLICY|TRANSFORMER_POLICY', // REQUIRED
    'scope' => 'ALL',
    'selectionCriteria' => '<string>',
]);

Parameter Details

Members
policyDocument
Required: Yes
Type: string

Specify the policy, in JSON.

Data protection policy

A data protection policy must include two JSON blocks:

  • The first block must include both a DataIdentifer array and an Operation property with an Audit action. The DataIdentifer array lists the types of sensitive data that you want to mask. For more information about the available options, see Types of data that you can mask.

    The Operation property with an Audit action is required to find the sensitive data terms. This Audit action must contain a FindingsDestination object. You can optionally use that FindingsDestination object to list one or more destinations to send audit findings to. If you specify destinations such as log groups, Firehose streams, and S3 buckets, they must already exist.

  • The second block must include both a DataIdentifer array and an Operation property with an Deidentify action. The DataIdentifer array must exactly match the DataIdentifer array in the first block of the policy.

    The Operation property with the Deidentify action is what actually masks the data, and it must contain the "MaskConfig": {} object. The "MaskConfig": {} object must be empty.

For an example data protection policy, see the Examples section on this page.

The contents of the two DataIdentifer arrays must match exactly.

In addition to the two JSON blocks, the policyDocument can also include Name, Description, and Version fields. The Name is different than the operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports audit findings metrics to CloudWatch.

The JSON specified in policyDocument can be up to 30,720 characters long.

Subscription filter policy

A subscription filter policy can include the following attributes in a JSON block:

  • DestinationArn The ARN of the destination to deliver log events to. Supported destinations are:

    • An Kinesis Data Streams data stream in the same account as the subscription policy, for same-account delivery.

    • An Firehose data stream in the same account as the subscription policy, for same-account delivery.

    • A Lambda function in the same account as the subscription policy, for same-account delivery.

    • A logical destination in a different account created with PutDestination, for cross-account delivery. Kinesis Data Streams and Firehose are supported as logical destinations.

  • RoleArn The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.

  • FilterPattern A filter pattern for subscribing to a filtered stream of log events.

  • Distribution The method used to distribute log data to the destination. By default, log data is grouped by log stream, but the grouping can be set to Random for a more even distribution. This property is only applicable when the destination is an Kinesis Data Streams data stream.

Transformer policy

A transformer policy must include one JSON block with the array of processors and their configurations. For more information about available processors, see Processors that you can use.

Field index policy

A field index filter policy can include the following attribute in a JSON block:

  • Fields The array of field indexes to create.

It must contain at least one field index.

The following is an example of an index policy document that creates two indexes, RequestId and TransactionId.

"policyDocument": "{ \"Fields\": [ \"RequestId\", \"TransactionId\" ] }"

policyName
Required: Yes
Type: string

A name for the policy. This must be unique within the account.

policyType
Required: Yes
Type: string

The type of policy that you're creating or updating.

scope
Type: string

Currently the only valid value for this parameter is ALL, which specifies that the data protection policy applies to all log groups in the account. If you omit this parameter, the default of ALL is used.

selectionCriteria
Type: string

Use this parameter to apply the new policy to a subset of log groups in the account.

Specifing selectionCriteria is valid only when you specify SUBSCRIPTION_FILTER_POLICY, FIELD_INDEX_POLICY or TRANSFORMER_POLICYfor policyType.

If policyType is SUBSCRIPTION_FILTER_POLICY, the only supported selectionCriteria filter is LogGroupName NOT IN []

If policyType is FIELD_INDEX_POLICY or TRANSFORMER_POLICY, the only supported selectionCriteria filter is LogGroupNamePrefix

The selectionCriteria string can be up to 25KB in length. The length is determined by using its UTF-8 bytes.

Using the selectionCriteria parameter with SUBSCRIPTION_FILTER_POLICY is useful to help prevent infinite loops. For more information, see Log recursion prevention.

Result Syntax

[
    'accountPolicy' => [
        'accountId' => '<string>',
        'lastUpdatedTime' => <integer>,
        'policyDocument' => '<string>',
        'policyName' => '<string>',
        'policyType' => 'DATA_PROTECTION_POLICY|SUBSCRIPTION_FILTER_POLICY|FIELD_INDEX_POLICY|TRANSFORMER_POLICY',
        'scope' => 'ALL',
        'selectionCriteria' => '<string>',
    ],
]

Result Details

Members
accountPolicy
Type: AccountPolicy structure

The account policy that you created.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

LimitExceededException:

You have reached the maximum number of resources that can be created.

PutDataProtectionPolicy

$result = $client->putDataProtectionPolicy([/* ... */]);
$promise = $client->putDataProtectionPolicyAsync([/* ... */]);

Creates a data protection policy for the specified log group. A data protection policy can help safeguard sensitive data that's ingested by the log group by auditing and masking the sensitive log data.

Sensitive data is detected and masked when it is ingested into the log group. When you set a data protection policy, log events ingested into the log group before that time are not masked.

By default, when a user views a log event that includes masked data, the sensitive data is replaced by asterisks. A user who has the logs:Unmask permission can use a GetLogEvents or FilterLogEvents operation with the unmask parameter set to true to view the unmasked log events. Users with the logs:Unmask can also view unmasked data in the CloudWatch Logs console by running a CloudWatch Logs Insights query with the unmask query command.

For more information, including a list of types of data that can be audited and masked, see Protect sensitive log data with masking.

The PutDataProtectionPolicy operation applies to only the specified log group. You can also use PutAccountPolicy to create an account-level data protection policy that applies to all log groups in the account, including both existing log groups and log groups that are created level. If a log group has its own data protection policy and the account also has an account-level data protection policy, then the two policies are cumulative. Any sensitive term specified in either policy is masked.

Parameter Syntax

$result = $client->putDataProtectionPolicy([
    'logGroupIdentifier' => '<string>', // REQUIRED
    'policyDocument' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

Specify either the log group name or log group ARN.

policyDocument
Required: Yes
Type: string

Specify the data protection policy, in JSON.

This policy must include two JSON blocks:

  • The first block must include both a DataIdentifer array and an Operation property with an Audit action. The DataIdentifer array lists the types of sensitive data that you want to mask. For more information about the available options, see Types of data that you can mask.

    The Operation property with an Audit action is required to find the sensitive data terms. This Audit action must contain a FindingsDestination object. You can optionally use that FindingsDestination object to list one or more destinations to send audit findings to. If you specify destinations such as log groups, Firehose streams, and S3 buckets, they must already exist.

  • The second block must include both a DataIdentifer array and an Operation property with an Deidentify action. The DataIdentifer array must exactly match the DataIdentifer array in the first block of the policy.

    The Operation property with the Deidentify action is what actually masks the data, and it must contain the "MaskConfig": {} object. The "MaskConfig": {} object must be empty.

For an example data protection policy, see the Examples section on this page.

The contents of the two DataIdentifer arrays must match exactly.

In addition to the two JSON blocks, the policyDocument can also include Name, Description, and Version fields. The Name is used as a dimension when CloudWatch Logs reports audit findings metrics to CloudWatch.

The JSON specified in policyDocument can be up to 30,720 characters.

Result Syntax

[
    'lastUpdatedTime' => <integer>,
    'logGroupIdentifier' => '<string>',
    'policyDocument' => '<string>',
]

Result Details

Members
lastUpdatedTime
Type: long (int|float)

The date and time that this policy was most recently updated.

logGroupIdentifier
Type: string

The log group name or ARN that you specified in your request.

policyDocument
Type: string

The data protection policy used for this log group.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

PutDeliveryDestination

$result = $client->putDeliveryDestination([/* ... */]);
$promise = $client->putDeliveryDestinationAsync([/* ... */]);

Creates or updates a logical delivery destination. A delivery destination is an Amazon Web Services resource that represents an Amazon Web Services service that logs can be sent to. CloudWatch Logs, Amazon S3, and Firehose are supported as logs delivery destinations.

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.

  • Use PutDeliveryDestination to create a delivery destination, which is a logical object that represents the actual delivery destination.

  • 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. For more information, see CreateDelivery.

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.

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

If you use this operation to update an existing delivery destination, all the current delivery destination parameters are overwritten with the new parameter values that you specify.

Parameter Syntax

$result = $client->putDeliveryDestination([
    'deliveryDestinationConfiguration' => [ // REQUIRED
        'destinationResourceArn' => '<string>', // REQUIRED
    ],
    'name' => '<string>', // REQUIRED
    'outputFormat' => 'json|plain|w3c|raw|parquet',
    'tags' => ['<string>', ...],
]);

Parameter Details

Members
deliveryDestinationConfiguration
Required: Yes
Type: DeliveryDestinationConfiguration structure

A structure that contains the ARN of the Amazon Web Services resource that will receive the logs.

name
Required: Yes
Type: string

A name for this delivery destination. This name must be unique for all delivery destinations in your account.

outputFormat
Type: string

The format for the logs that this delivery destination will receive.

tags
Type: Associative array of custom strings keys (TagKey) to strings

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

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

Result Syntax

[
    'deliveryDestination' => [
        'arn' => '<string>',
        'deliveryDestinationConfiguration' => [
            'destinationResourceArn' => '<string>',
        ],
        'deliveryDestinationType' => 'S3|CWL|FH',
        'name' => '<string>',
        'outputFormat' => 'json|plain|w3c|raw|parquet',
        'tags' => ['<string>', ...],
    ],
]

Result Details

Members
deliveryDestination
Type: DeliveryDestination structure

A structure containing information about the delivery destination that you just created or updated.

Errors

ServiceUnavailableException:

The service cannot complete the request.

ConflictException:

This operation attempted to create a resource that already exists.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ThrottlingException:

The request was throttled because of quota limits.

ResourceNotFoundException:

The specified resource does not exist.

PutDeliveryDestinationPolicy

$result = $client->putDeliveryDestinationPolicy([/* ... */]);
$promise = $client->putDeliveryDestinationPolicyAsync([/* ... */]);

Creates and assigns an IAM policy that grants permissions to CloudWatch Logs to deliver logs cross-account to a specified destination in this account. To configure the delivery of logs from an Amazon Web Services service in another account to a logs delivery destination in the current account, 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.

  • Use this operation in the destination account to assign an IAM policy to the destination. This policy allows delivery to that destination.

  • Create a delivery by pairing exactly one delivery source and one delivery destination. For more information, see CreateDelivery.

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

The contents of the policy must include two statements. One statement enables general logs delivery, and the other allows delivery to the chosen destination. See the examples for the needed policies.

Parameter Syntax

$result = $client->putDeliveryDestinationPolicy([
    'deliveryDestinationName' => '<string>', // REQUIRED
    'deliveryDestinationPolicy' => '<string>', // REQUIRED
]);

Parameter Details

Members
deliveryDestinationName
Required: Yes
Type: string

The name of the delivery destination to assign this policy to.

deliveryDestinationPolicy
Required: Yes
Type: string

The contents of the policy.

Result Syntax

[
    'policy' => [
        'deliveryDestinationPolicy' => '<string>',
    ],
]

Result Details

Members
policy
Type: Policy structure

The contents of the policy that you just created.

Errors

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

ResourceNotFoundException:

The specified resource does not exist.

ConflictException:

This operation attempted to create a resource that already exists.

PutDeliverySource

$result = $client->putDeliverySource([/* ... */]);
$promise = $client->putDeliverySourceAsync([/* ... */]);

Creates or updates a logical delivery source. 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.

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

  • Use PutDeliverySource to create a delivery source, which is a logical object that represents the resource that is actually sending the logs.

  • Use PutDeliveryDestination to 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. For more information, see CreateDelivery.

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.

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

If you use this operation to update an existing delivery source, all the current delivery source parameters are overwritten with the new parameter values that you specify.

Parameter Syntax

$result = $client->putDeliverySource([
    'logType' => '<string>', // REQUIRED
    'name' => '<string>', // REQUIRED
    'resourceArn' => '<string>', // REQUIRED
    'tags' => ['<string>', ...],
]);

Parameter Details

Members
logType
Required: Yes
Type: string

Defines the type of log that the source is sending.

  • For Amazon Bedrock, the valid value is APPLICATION_LOGS.

  • For Amazon CodeWhisperer, the valid value is EVENT_LOGS.

  • For IAM Identity Center, the valid value is ERROR_LOGS.

  • For Amazon WorkMail, the valid values are ACCESS_CONTROL_LOGS, AUTHENTICATION_LOGS, WORKMAIL_AVAILABILITY_PROVIDER_LOGS, and WORKMAIL_MAILBOX_ACCESS_LOGS.

name
Required: Yes
Type: string

A name for this delivery source. This name must be unique for all delivery sources in your account.

resourceArn
Required: Yes
Type: string

The ARN of the Amazon Web Services resource that is generating and sending logs. For example, arn:aws:workmail:us-east-1:123456789012:organization/m-1234EXAMPLEabcd1234abcd1234abcd1234

tags
Type: Associative array of custom strings keys (TagKey) to strings

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

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

Result Syntax

[
    'deliverySource' => [
        'arn' => '<string>',
        'logType' => '<string>',
        'name' => '<string>',
        'resourceArns' => ['<string>', ...],
        'service' => '<string>',
        'tags' => ['<string>', ...],
    ],
]

Result Details

Members
deliverySource
Type: DeliverySource structure

A structure containing information about the delivery source that was just created or updated.

Errors

ServiceUnavailableException:

The service cannot complete the request.

ConflictException:

This operation attempted to create a resource that already exists.

ValidationException:

One of the parameters for the request is not valid.

ServiceQuotaExceededException:

This request exceeds a service quota.

ResourceNotFoundException:

The specified resource does not exist.

ThrottlingException:

The request was throttled because of quota limits.

PutDestination

$result = $client->putDestination([/* ... */]);
$promise = $client->putDestinationAsync([/* ... */]);

Creates or updates a destination. This operation is used only to create destinations for cross-account subscriptions.

A destination encapsulates a physical resource (such as an Amazon Kinesis stream). With a destination, you can subscribe to a real-time stream of log events for a different account, ingested using PutLogEvents.

Through an access policy, a destination controls what is written to it. By default, PutDestination does not set any access policy with the destination, which means a cross-account user cannot call PutSubscriptionFilter against this destination. To enable this, the destination owner must call PutDestinationPolicy after PutDestination.

To perform a PutDestination operation, you must also have the iam:PassRole permission.

Parameter Syntax

$result = $client->putDestination([
    'destinationName' => '<string>', // REQUIRED
    'roleArn' => '<string>', // REQUIRED
    'tags' => ['<string>', ...],
    'targetArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
destinationName
Required: Yes
Type: string

A name for the destination.

roleArn
Required: Yes
Type: string

The ARN of an IAM role that grants CloudWatch Logs permissions to call the Amazon Kinesis PutRecord operation on the destination stream.

tags
Type: Associative array of custom strings keys (TagKey) to strings

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

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

targetArn
Required: Yes
Type: string

The ARN of an Amazon Kinesis stream to which to deliver matching log events.

Result Syntax

[
    'destination' => [
        'accessPolicy' => '<string>',
        'arn' => '<string>',
        'creationTime' => <integer>,
        'destinationName' => '<string>',
        'roleArn' => '<string>',
        'targetArn' => '<string>',
    ],
]

Result Details

Members
destination
Type: Destination structure

The destination.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

PutDestinationPolicy

$result = $client->putDestinationPolicy([/* ... */]);
$promise = $client->putDestinationPolicyAsync([/* ... */]);

Creates or updates an access policy associated with an existing destination. An access policy is an IAM policy document that is used to authorize claims to register a subscription filter against a given destination.

Parameter Syntax

$result = $client->putDestinationPolicy([
    'accessPolicy' => '<string>', // REQUIRED
    'destinationName' => '<string>', // REQUIRED
    'forceUpdate' => true || false,
]);

Parameter Details

Members
accessPolicy
Required: Yes
Type: string

An IAM policy document that authorizes cross-account users to deliver their log events to the associated destination. This can be up to 5120 bytes.

destinationName
Required: Yes
Type: string

A name for an existing destination.

forceUpdate
Type: boolean

Specify true if you are updating an existing destination policy to grant permission to an organization ID instead of granting permission to individual Amazon Web Services accounts. Before you update a destination policy this way, you must first update the subscription filters in the accounts that send logs to this destination. If you do not, the subscription filters might stop working. By specifying true for forceUpdate, you are affirming that you have already updated the subscription filters. For more information, see Updating an existing cross-account subscription

If you omit this parameter, the default of false is used.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

PutIndexPolicy

$result = $client->putIndexPolicy([/* ... */]);
$promise = $client->putIndexPolicyAsync([/* ... */]);

Creates or updates a field index policy for the specified log group. Only log groups in the Standard log class support field index policies. For more information about log classes, see Log classes.

You can use field index policies to create field indexes on fields found in log events in the log group. Creating field indexes speeds up and lowers the costs for CloudWatch Logs Insights queries that reference those field indexes, because these queries attempt to skip the processing of log events that are known to not match the indexed field. Good fields to index are fields that you often need to query for and fields or values that match only a small fraction of the total log events. Common examples of indexes include request ID, session ID, userID, and instance IDs. For more information, see Create field indexes to improve query performance and reduce costs.

To find the fields that are in your log group events, use the GetLogGroupFields operation.

For example, suppose you have created a field index for requestId. Then, any CloudWatch Logs Insights query on that log group that includes requestId = value or requestId IN [value, value, ...] will process fewer log events to reduce costs, and have improved performance.

Each index policy has the following quotas and restrictions:

  • As many as 20 fields can be included in the policy.

  • Each field name can include as many as 100 characters.

Matches of log events to the names of indexed fields are case-sensitive. For example, a field index of RequestId won't match a log event containing requestId.

Log group-level field index policies created with PutIndexPolicy override account-level field index policies created with PutAccountPolicy. If you use PutIndexPolicy to create a field index policy for a log group, that log group uses only that policy. The log group ignores any account-wide field index policy that you might have created.

Parameter Syntax

$result = $client->putIndexPolicy([
    'logGroupIdentifier' => '<string>', // REQUIRED
    'policyDocument' => '<string>', // REQUIRED
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

Specify either the log group name or log group ARN to apply this field index policy to. If you specify an ARN, use the format arn:aws:logs:region:account-id:log-group:log_group_name Don't include an * at the end.

policyDocument
Required: Yes
Type: string

The index policy document, in JSON format. The following is an example of an index policy document that creates two indexes, RequestId and TransactionId.

"policyDocument": "{ "Fields": [ "RequestId", "TransactionId" ] }"

The policy document must include at least one field index. For more information about the fields that can be included and other restrictions, see Field index syntax and quotas.

Result Syntax

[
    'indexPolicy' => [
        'lastUpdateTime' => <integer>,
        'logGroupIdentifier' => '<string>',
        'policyDocument' => '<string>',
        'policyName' => '<string>',
        'source' => 'ACCOUNT|LOG_GROUP',
    ],
]

Result Details

Members
indexPolicy
Type: IndexPolicy structure

The index policy that you just created or updated.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

PutIntegration

$result = $client->putIntegration([/* ... */]);
$promise = $client->putIntegrationAsync([/* ... */]);

Creates an integration between CloudWatch Logs and another service in this account. Currently, only integrations with OpenSearch Service are supported, and currently you can have only one integration in your account.

Integrating with OpenSearch Service makes it possible for you to create curated vended logs dashboards, powered by OpenSearch Service analytics. For more information, see Vended log dashboards powered by Amazon OpenSearch Service.

You can use this operation only to create a new integration. You can't modify an existing integration.

Parameter Syntax

$result = $client->putIntegration([
    'integrationName' => '<string>', // REQUIRED
    'integrationType' => 'OPENSEARCH', // REQUIRED
    'resourceConfig' => [ // REQUIRED
        'openSearchResourceConfig' => [
            'applicationArn' => '<string>',
            'dashboardViewerPrincipals' => ['<string>', ...], // REQUIRED
            'dataSourceRoleArn' => '<string>', // REQUIRED
            'kmsKeyArn' => '<string>',
            'retentionDays' => <integer>, // REQUIRED
        ],
    ],
]);

Parameter Details

Members
integrationName
Required: Yes
Type: string

A name for the integration.

integrationType
Required: Yes
Type: string

The type of integration. Currently, the only supported type is OPENSEARCH.

resourceConfig
Required: Yes
Type: ResourceConfig structure

A structure that contains configuration information for the integration that you are creating.

Result Syntax

[
    'integrationName' => '<string>',
    'integrationStatus' => 'PROVISIONING|ACTIVE|FAILED',
]

Result Details

Members
integrationName
Type: string

The name of the integration that you just created.

integrationStatus
Type: string

The status of the integration that you just created.

After you create an integration, it takes a few minutes to complete. During this time, you'll see the status as PROVISIONING.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ServiceUnavailableException:

The service cannot complete the request.

ValidationException:

One of the parameters for the request is not valid.

PutLogEvents

$result = $client->putLogEvents([/* ... */]);
$promise = $client->putLogEventsAsync([/* ... */]);

Uploads a batch of log events to the specified log stream.

The sequence token is now ignored in PutLogEvents actions. PutLogEvents actions are always accepted and never return InvalidSequenceTokenException or DataAlreadyAcceptedException even if the sequence token is not valid. You can use parallel PutLogEvents actions on the same log stream.

The batch of events must satisfy the following constraints:

  • The maximum batch size is 1,048,576 bytes. This size is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each log event.

  • None of the log events in the batch can be more than 2 hours in the future.

  • None of the log events in the batch can be more than 14 days in the past. Also, none of the log events can be from earlier than the retention period of the log group.

  • The log events in the batch must be in chronological order by their timestamp. The timestamp is the time that the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. (In Amazon Web Services Tools for PowerShell and the Amazon Web Services SDK for .NET, the timestamp is specified in .NET format: yyyy-mm-ddThh:mm:ss. For example, 2017-09-15T13:45:30.)

  • A batch of log events in a single request cannot span more than 24 hours. Otherwise, the operation fails.

  • Each log event can be no larger than 256 KB.

  • The maximum number of log events in a batch is 10,000.

  • The quota of five requests per second per log stream has been removed. Instead, PutLogEvents actions are throttled based on a per-second per-account quota. You can request an increase to the per-second throttling quota by using the Service Quotas service.

If a call to PutLogEvents returns "UnrecognizedClientException" the most likely cause is a non-valid Amazon Web Services access key ID or secret key.

Parameter Syntax

$result = $client->putLogEvents([
    'entity' => [
        'attributes' => ['<string>', ...],
        'keyAttributes' => ['<string>', ...],
    ],
    'logEvents' => [ // REQUIRED
        [
            'message' => '<string>', // REQUIRED
            'timestamp' => <integer>, // REQUIRED
        ],
        // ...
    ],
    'logGroupName' => '<string>', // REQUIRED
    'logStreamName' => '<string>', // REQUIRED
    'sequenceToken' => '<string>',
]);

Parameter Details

Members
entity
Type: Entity structure

The entity associated with the log events.

logEvents
Required: Yes
Type: Array of InputLogEvent structures

The log events.

logGroupName
Required: Yes
Type: string

The name of the log group.

logStreamName
Required: Yes
Type: string

The name of the log stream.

sequenceToken
Type: string

The sequence token obtained from the response of the previous PutLogEvents call.

The sequenceToken parameter is now ignored in PutLogEvents actions. PutLogEvents actions are now accepted and never return InvalidSequenceTokenException or DataAlreadyAcceptedException even if the sequence token is not valid.

Result Syntax

[
    'nextSequenceToken' => '<string>',
    'rejectedEntityInfo' => [
        'errorType' => 'InvalidEntity|InvalidTypeValue|InvalidKeyAttributes|InvalidAttributes|EntitySizeTooLarge|UnsupportedLogGroupType|MissingRequiredFields',
    ],
    'rejectedLogEventsInfo' => [
        'expiredLogEventEndIndex' => <integer>,
        'tooNewLogEventStartIndex' => <integer>,
        'tooOldLogEventEndIndex' => <integer>,
    ],
]

Result Details

Members
nextSequenceToken
Type: string

The next sequence token.

This field has been deprecated.

The sequence token is now ignored in PutLogEvents actions. PutLogEvents actions are always accepted even if the sequence token is not valid. You can use parallel PutLogEvents actions on the same log stream and you do not need to wait for the response of a previous PutLogEvents action to obtain the nextSequenceToken value.

rejectedEntityInfo
Type: RejectedEntityInfo structure

Information about why the entity is rejected when calling PutLogEvents. Only returned when the entity is rejected.

When the entity is rejected, the events may still be accepted.

rejectedLogEventsInfo
Type: RejectedLogEventsInfo structure

The rejected events.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

InvalidSequenceTokenException:

The sequence token is not valid. You can get the correct sequence token in the expectedSequenceToken field in the InvalidSequenceTokenException message.

PutLogEvents actions are now always accepted and never return InvalidSequenceTokenException regardless of receiving an invalid sequence token.

DataAlreadyAcceptedException:

The event was already logged.

PutLogEvents actions are now always accepted and never return DataAlreadyAcceptedException regardless of whether a given batch of log events has already been accepted.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

UnrecognizedClientException:

The most likely cause is an Amazon Web Services access key ID or secret key that's not valid.

PutMetricFilter

$result = $client->putMetricFilter([/* ... */]);
$promise = $client->putMetricFilterAsync([/* ... */]);

Creates or updates a metric filter and associates it with the specified log group. With metric filters, you can configure rules to extract metric data from log events ingested through PutLogEvents.

The maximum number of metric filters that can be associated with a log group is 100.

Using regular expressions to create metric filters is supported. For these filters, there is a quota of two regular expression patterns within a single filter pattern. There is also a quota of five regular expression patterns per log group. For more information about using regular expressions in metric filters, see Filter pattern syntax for metric filters, subscription filters, filter log events, and Live Tail.

When you create a metric filter, you can also optionally assign a unit and dimensions to the metric that is created.

Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress or requestID as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

CloudWatch Logs might disable a metric filter if it generates 1,000 different name/value pairs for your specified dimensions within one hour.

You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges.

Parameter Syntax

$result = $client->putMetricFilter([
    'applyOnTransformedLogs' => true || false,
    'filterName' => '<string>', // REQUIRED
    'filterPattern' => '<string>', // REQUIRED
    'logGroupName' => '<string>', // REQUIRED
    'metricTransformations' => [ // REQUIRED
        [
            'defaultValue' => <float>,
            'dimensions' => ['<string>', ...],
            'metricName' => '<string>', // REQUIRED
            'metricNamespace' => '<string>', // REQUIRED
            'metricValue' => '<string>', // REQUIRED
            'unit' => 'Seconds|Microseconds|Milliseconds|Bytes|Kilobytes|Megabytes|Gigabytes|Terabytes|Bits|Kilobits|Megabits|Gigabits|Terabits|Percent|Count|Bytes/Second|Kilobytes/Second|Megabytes/Second|Gigabytes/Second|Terabytes/Second|Bits/Second|Kilobits/Second|Megabits/Second|Gigabits/Second|Terabits/Second|Count/Second|None',
        ],
        // ...
    ],
]);

Parameter Details

Members
applyOnTransformedLogs
Type: boolean

This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see PutTransformer.

If the log group uses either a log-group level or account-level transformer, and you specify true, the metric filter will be applied on the transformed version of the log events instead of the original ingested log events.

filterName
Required: Yes
Type: string

A name for the metric filter.

filterPattern
Required: Yes
Type: string

A filter pattern for extracting metric data out of ingested log events.

logGroupName
Required: Yes
Type: string

The name of the log group.

metricTransformations
Required: Yes
Type: Array of MetricTransformation structures

A collection of information that defines how metric data gets emitted.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ServiceUnavailableException:

The service cannot complete the request.

InvalidOperationException:

The operation is not valid on the specified resource.

PutQueryDefinition

$result = $client->putQueryDefinition([/* ... */]);
$promise = $client->putQueryDefinitionAsync([/* ... */]);

Creates or updates a query definition for CloudWatch Logs Insights. For more information, see Analyzing Log Data with CloudWatch Logs Insights.

To update a query definition, specify its queryDefinitionId in your request. The values of name, queryString, and logGroupNames are changed to the values that you specify in your update operation. No current values are retained from the current query definition. For example, imagine updating a current query definition that includes log groups. If you don't specify the logGroupNames parameter in your update operation, the query definition changes to contain no log groups.

You must have the logs:PutQueryDefinition permission to be able to perform this operation.

Parameter Syntax

$result = $client->putQueryDefinition([
    'clientToken' => '<string>',
    'logGroupNames' => ['<string>', ...],
    'name' => '<string>', // REQUIRED
    'queryDefinitionId' => '<string>',
    'queryLanguage' => 'CWLI|SQL|PPL',
    'queryString' => '<string>', // REQUIRED
]);

Parameter Details

Members
clientToken
Type: string

Used as an idempotency token, to avoid returning an exception if the service receives the same request twice because of a network error.

logGroupNames
Type: Array of strings

Use this parameter to include specific log groups as part of your query definition. If your query uses the OpenSearch Service query language, you specify the log group names inside the querystring instead of here.

If you are updating an existing query definition for the Logs Insights QL or OpenSearch Service PPL and you omit this parameter, then the updated definition will contain no log groups.

name
Required: Yes
Type: string

A name for the query definition. If you are saving numerous query definitions, we recommend that you name them. This way, you can find the ones you want by using the first part of the name as a filter in the queryDefinitionNamePrefix parameter of DescribeQueryDefinitions.

queryDefinitionId
Type: string

If you are updating a query definition, use this parameter to specify the ID of the query definition that you want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.

If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the new query definition and include it in the response to this operation.

queryLanguage
Type: string

Specify the query language to use for this query. The options are Logs Insights QL, OpenSearch PPL, and OpenSearch SQL. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

queryString
Required: Yes
Type: string

The query string to use for this definition. For more information, see CloudWatch Logs Insights Query Syntax.

Result Syntax

[
    'queryDefinitionId' => '<string>',
]

Result Details

Members
queryDefinitionId
Type: string

The ID of the query definition.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

PutResourcePolicy

$result = $client->putResourcePolicy([/* ... */]);
$promise = $client->putResourcePolicyAsync([/* ... */]);

Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53. An account can have up to 10 resource policies per Amazon Web Services Region.

Parameter Syntax

$result = $client->putResourcePolicy([
    'policyDocument' => '<string>',
    'policyName' => '<string>',
]);

Parameter Details

Members
policyDocument
Type: string

Details of the new policy, including the identity of the principal that is enabled to put logs to this account. This is formatted as a JSON string. This parameter is required.

The following example creates a resource policy enabling the Route 53 service to put DNS query logs in to the specified log group. Replace "logArn" with the ARN of your CloudWatch Logs resource, such as a log group or log stream.

CloudWatch Logs also supports aws:SourceArn and aws:SourceAccount condition context keys.

In the example resource policy, you would replace the value of SourceArn with the resource making the call from Route 53 to CloudWatch Logs. You would also replace the value of SourceAccount with the Amazon Web Services account ID making that call.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "Route53LogsToCloudWatchLogs", "Effect": "Allow", "Principal": { "Service": [ "route53.amazonaws.com" ] }, "Action": "logs:PutLogEvents", "Resource": "logArn", "Condition": { "ArnLike": { "aws:SourceArn": "myRoute53ResourceArn" }, "StringEquals": { "aws:SourceAccount": "myAwsAccountId" } } } ] }

policyName
Type: string

Name of the new policy. This parameter is required.

Result Syntax

[
    'resourcePolicy' => [
        'lastUpdatedTime' => <integer>,
        'policyDocument' => '<string>',
        'policyName' => '<string>',
    ],
]

Result Details

Members
resourcePolicy
Type: ResourcePolicy structure

The new policy.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ServiceUnavailableException:

The service cannot complete the request.

PutRetentionPolicy

$result = $client->putRetentionPolicy([/* ... */]);
$promise = $client->putRetentionPolicyAsync([/* ... */]);

Sets the retention of the specified log group. With a retention policy, you can configure the number of days for which to retain log events in the specified log group.

CloudWatch Logs doesn't immediately delete log events when they reach their retention setting. It typically takes up to 72 hours after that before log events are deleted, but in rare situations might take longer.

To illustrate, imagine that you change a log group to have a longer retention setting when it contains log events that are past the expiration date, but haven't been deleted. Those log events will take up to 72 hours to be deleted after the new retention date is reached. To make sure that log data is deleted permanently, keep a log group at its lower retention setting until 72 hours after the previous retention period ends. Alternatively, wait to change the retention setting until you confirm that the earlier log events are deleted.

When log events reach their retention setting they are marked for deletion. After they are marked for deletion, they do not add to your archival storage costs anymore, even if they are not actually deleted until later. These log events marked for deletion are also not included when you use an API to retrieve the storedBytes value to see how many bytes a log group is storing.

Parameter Syntax

$result = $client->putRetentionPolicy([
    'logGroupName' => '<string>', // REQUIRED
    'retentionInDays' => <integer>, // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

retentionInDays
Required: Yes
Type: int

The number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, and 3653.

To set a log group so that its log events do not expire, use DeleteRetentionPolicy.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

ServiceUnavailableException:

The service cannot complete the request.

PutSubscriptionFilter

$result = $client->putSubscriptionFilter([/* ... */]);
$promise = $client->putSubscriptionFilterAsync([/* ... */]);

Creates or updates a subscription filter and associates it with the specified log group. With subscription filters, you can subscribe to a real-time stream of log events ingested through PutLogEvents and have them delivered to a specific destination. When log events are sent to the receiving service, they are Base64 encoded and compressed with the GZIP format.

The following destinations are supported for subscription filters:

  • An Amazon Kinesis data stream belonging to the same account as the subscription filter, for same-account delivery.

  • A logical destination created with PutDestination that belongs to a different account, for cross-account delivery. We currently support Kinesis Data Streams and Firehose as logical destinations.

  • An Amazon Kinesis Data Firehose delivery stream that belongs to the same account as the subscription filter, for same-account delivery.

  • An Lambda function that belongs to the same account as the subscription filter, for same-account delivery.

Each log group can have up to two subscription filters associated with it. If you are updating an existing filter, you must specify the correct name in filterName.

Using regular expressions to create subscription filters is supported. For these filters, there is a quotas of quota of two regular expression patterns within a single filter pattern. There is also a quota of five regular expression patterns per log group. For more information about using regular expressions in subscription filters, see Filter pattern syntax for metric filters, subscription filters, filter log events, and Live Tail.

To perform a PutSubscriptionFilter operation for any destination except a Lambda function, you must also have the iam:PassRole permission.

Parameter Syntax

$result = $client->putSubscriptionFilter([
    'applyOnTransformedLogs' => true || false,
    'destinationArn' => '<string>', // REQUIRED
    'distribution' => 'Random|ByLogStream',
    'filterName' => '<string>', // REQUIRED
    'filterPattern' => '<string>', // REQUIRED
    'logGroupName' => '<string>', // REQUIRED
    'roleArn' => '<string>',
]);

Parameter Details

Members
applyOnTransformedLogs
Type: boolean

This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see PutTransformer.

If the log group uses either a log-group level or account-level transformer, and you specify true, the subscription filter will be applied on the transformed version of the log events instead of the original ingested log events.

destinationArn
Required: Yes
Type: string

The ARN of the destination to deliver matching log events to. Currently, the supported destinations are:

  • An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.

  • A logical destination (specified using an ARN) belonging to a different account, for cross-account delivery.

    If you're setting up a cross-account subscription, the destination must have an IAM policy associated with it. The IAM policy must allow the sender to send logs to the destination. For more information, see PutDestinationPolicy.

  • A Kinesis Data Firehose delivery stream belonging to the same account as the subscription filter, for same-account delivery.

  • A Lambda function belonging to the same account as the subscription filter, for same-account delivery.

distribution
Type: string

The method used to distribute log data to the destination. By default, log data is grouped by log stream, but the grouping can be set to random for a more even distribution. This property is only applicable when the destination is an Amazon Kinesis data stream.

filterName
Required: Yes
Type: string

A name for the subscription filter. If you are updating an existing filter, you must specify the correct name in filterName. To find the name of the filter currently associated with a log group, use DescribeSubscriptionFilters.

filterPattern
Required: Yes
Type: string

A filter pattern for subscribing to a filtered stream of log events.

logGroupName
Required: Yes
Type: string

The name of the log group.

roleArn
Type: string

The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ServiceUnavailableException:

The service cannot complete the request.

InvalidOperationException:

The operation is not valid on the specified resource.

PutTransformer

$result = $client->putTransformer([/* ... */]);
$promise = $client->putTransformerAsync([/* ... */]);

Creates or updates a log transformer for a single log group. You use log transformers to transform log events into a different format, making them easier for you to process and analyze. You can also transform logs from different sources into standardized formats that contains relevant, source-specific information.

After you have created a transformer, CloudWatch Logs performs the transformations at the time of log ingestion. You can then refer to the transformed versions of the logs during operations such as querying with CloudWatch Logs Insights or creating metric filters or subscription filers.

You can also use a transformer to copy metadata from metadata keys into the log events themselves. This metadata can include log group name, log stream name, account ID and Region.

A transformer for a log group is a series of processors, where each processor applies one type of transformation to the log events ingested into this log group. The processors work one after another, in the order that you list them, like a pipeline. For more information about the available processors to use in a transformer, see Processors that you can use.

Having log events in standardized format enables visibility across your applications for your log analysis, reporting, and alarming needs. CloudWatch Logs provides transformation for common log types with out-of-the-box transformation templates for major Amazon Web Services log sources such as VPC flow logs, Lambda, and Amazon RDS. You can use pre-built transformation templates or create custom transformation policies.

You can create transformers only for the log groups in the Standard log class.

You can also set up a transformer at the account level. For more information, see PutAccountPolicy. If there is both a log-group level transformer created with PutTransformer and an account-level transformer that could apply to the same log group, the log group uses only the log-group level transformer. It ignores the account-level transformer.

Parameter Syntax

$result = $client->putTransformer([
    'logGroupIdentifier' => '<string>', // REQUIRED
    'transformerConfig' => [ // REQUIRED
        [
            'addKeys' => [
                'entries' => [ // REQUIRED
                    [
                        'key' => '<string>', // REQUIRED
                        'overwriteIfExists' => true || false,
                        'value' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'copyValue' => [
                'entries' => [ // REQUIRED
                    [
                        'overwriteIfExists' => true || false,
                        'source' => '<string>', // REQUIRED
                        'target' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'csv' => [
                'columns' => ['<string>', ...],
                'delimiter' => '<string>',
                'quoteCharacter' => '<string>',
                'source' => '<string>',
            ],
            'dateTimeConverter' => [
                'locale' => '<string>',
                'matchPatterns' => ['<string>', ...], // REQUIRED
                'source' => '<string>', // REQUIRED
                'sourceTimezone' => '<string>',
                'target' => '<string>', // REQUIRED
                'targetFormat' => '<string>',
                'targetTimezone' => '<string>',
            ],
            'deleteKeys' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
            'grok' => [
                'match' => '<string>', // REQUIRED
                'source' => '<string>',
            ],
            'listToMap' => [
                'flatten' => true || false,
                'flattenedElement' => 'first|last',
                'key' => '<string>', // REQUIRED
                'source' => '<string>', // REQUIRED
                'target' => '<string>',
                'valueKey' => '<string>',
            ],
            'lowerCaseString' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
            'moveKeys' => [
                'entries' => [ // REQUIRED
                    [
                        'overwriteIfExists' => true || false,
                        'source' => '<string>', // REQUIRED
                        'target' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'parseCloudfront' => [
                'source' => '<string>',
            ],
            'parseJSON' => [
                'destination' => '<string>',
                'source' => '<string>',
            ],
            'parseKeyValue' => [
                'destination' => '<string>',
                'fieldDelimiter' => '<string>',
                'keyPrefix' => '<string>',
                'keyValueDelimiter' => '<string>',
                'nonMatchValue' => '<string>',
                'overwriteIfExists' => true || false,
                'source' => '<string>',
            ],
            'parsePostgres' => [
                'source' => '<string>',
            ],
            'parseRoute53' => [
                'source' => '<string>',
            ],
            'parseVPC' => [
                'source' => '<string>',
            ],
            'parseWAF' => [
                'source' => '<string>',
            ],
            'renameKeys' => [
                'entries' => [ // REQUIRED
                    [
                        'key' => '<string>', // REQUIRED
                        'overwriteIfExists' => true || false,
                        'renameTo' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'splitString' => [
                'entries' => [ // REQUIRED
                    [
                        'delimiter' => '<string>', // REQUIRED
                        'source' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'substituteString' => [
                'entries' => [ // REQUIRED
                    [
                        'from' => '<string>', // REQUIRED
                        'source' => '<string>', // REQUIRED
                        'to' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'trimString' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
            'typeConverter' => [
                'entries' => [ // REQUIRED
                    [
                        'key' => '<string>', // REQUIRED
                        'type' => 'boolean|integer|double|string', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'upperCaseString' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
        ],
        // ...
    ],
]);

Parameter Details

Members
logGroupIdentifier
Required: Yes
Type: string

Specify either the name or ARN of the log group to create the transformer for.

transformerConfig
Required: Yes
Type: Array of Processor structures

This structure contains the configuration of this log transformer. A log transformer is an array of processors, where each processor applies one type of transformation to the log events that are ingested.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

LimitExceededException:

You have reached the maximum number of resources that can be created.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

InvalidOperationException:

The operation is not valid on the specified resource.

StartLiveTail

$result = $client->startLiveTail([/* ... */]);
$promise = $client->startLiveTailAsync([/* ... */]);

Starts a Live Tail streaming session for one or more log groups. A Live Tail session returns a stream of log events that have been recently ingested in the log groups. For more information, see Use Live Tail to view logs in near real time.

The response to this operation is a response stream, over which the server sends live log events and the client receives them.

The following objects are sent over the stream:

  • A single LiveTailSessionStart object is sent at the start of the session.

  • Every second, a LiveTailSessionUpdate object is sent. Each of these objects contains an array of the actual log events.

    If no new log events were ingested in the past second, the LiveTailSessionUpdate object will contain an empty array.

    The array of log events contained in a LiveTailSessionUpdate can include as many as 500 log events. If the number of log events matching the request exceeds 500 per second, the log events are sampled down to 500 log events to be included in each LiveTailSessionUpdate object.

    If your client consumes the log events slower than the server produces them, CloudWatch Logs buffers up to 10 LiveTailSessionUpdate events or 5000 log events, after which it starts dropping the oldest events.

  • A SessionStreamingException object is returned if an unknown error occurs on the server side.

  • A SessionTimeoutException object is returned when the session times out, after it has been kept open for three hours.

You can end a session before it times out by closing the session stream or by closing the client that is receiving the stream. The session also ends if the established connection between the client and the server breaks.

For examples of using an SDK to start a Live Tail session, see Start a Live Tail session using an Amazon Web Services SDK.

Parameter Syntax

$result = $client->startLiveTail([
    'logEventFilterPattern' => '<string>',
    'logGroupIdentifiers' => ['<string>', ...], // REQUIRED
    'logStreamNamePrefixes' => ['<string>', ...],
    'logStreamNames' => ['<string>', ...],
]);

Parameter Details

Members
logEventFilterPattern
Type: string

An optional pattern to use to filter the results to include only log events that match the pattern. For example, a filter pattern of error 404 causes only log events that include both error and 404 to be included in the Live Tail stream.

Regular expression filter patterns are supported.

For more information about filter pattern syntax, see Filter and Pattern Syntax.

logGroupIdentifiers
Required: Yes
Type: Array of strings

An array where each item in the array is a log group to include in the Live Tail session.

Specify each log group by its ARN.

If you specify an ARN, the ARN can't end with an asterisk (*).

You can include up to 10 log groups.

logStreamNamePrefixes
Type: Array of strings

If you specify this parameter, then only log events in the log streams that have names that start with the prefixes that you specify here are included in the Live Tail session.

If you specify this field, you can't also specify the logStreamNames field.

You can specify this parameter only if you specify only one log group in logGroupIdentifiers.

logStreamNames
Type: Array of strings

If you specify this parameter, then only log events in the log streams that you specify here are included in the Live Tail session.

If you specify this field, you can't also specify the logStreamNamePrefixes field.

You can specify this parameter only if you specify only one log group in logGroupIdentifiers.

Result Syntax

[
    'responseStream' => [ // EventParsingIterator
        'SessionStreamingException' => [
            'message' => '<string>',
        ],
        'SessionTimeoutException' => [
            'message' => '<string>',
        ],
        'sessionStart' => [
            'logEventFilterPattern' => '<string>',
            'logGroupIdentifiers' => ['<string>', ...],
            'logStreamNamePrefixes' => ['<string>', ...],
            'logStreamNames' => ['<string>', ...],
            'requestId' => '<string>',
            'sessionId' => '<string>',
        ],
        'sessionUpdate' => [
            'sessionMetadata' => [
                'sampled' => true || false,
            ],
            'sessionResults' => [
                [
                    'ingestionTime' => <integer>,
                    'logGroupIdentifier' => '<string>',
                    'logStreamName' => '<string>',
                    'message' => '<string>',
                    'timestamp' => <integer>,
                ],
                // ...
            ],
        ],
    ],
]

Result Details

Members
responseStream
Type: EventParsingIterator supplying the following structures: LiveTailSessionStart, LiveTailSessionUpdate, SessionTimeoutException, SessionStreamingException

An object that includes the stream returned by your request. It can include both log events and exceptions.

Using an EventParsingIterator

To use an EventParsingIterator, you will need to loop over the events it will generate and check the top-level field to determine which type of event it is.

foreach($result['responseStream'] as $event) {
    if (isset($event['SessionStreamingException'])) {
        // Handle the 'SessionStreamingException' event.
    } else if (isset($event['SessionTimeoutException'])) {
        // Handle the 'SessionTimeoutException' event.
    } else if (isset($event['sessionStart'])) {
        // Handle the 'sessionStart' event.
    } else if (isset($event['sessionUpdate'])) {
        // Handle the 'sessionUpdate' event.
    }
}

Errors

AccessDeniedException:

You don't have sufficient permissions to perform this action.

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

LimitExceededException:

You have reached the maximum number of resources that can be created.

InvalidOperationException:

The operation is not valid on the specified resource.

StartQuery

$result = $client->startQuery([/* ... */]);
$promise = $client->startQueryAsync([/* ... */]);

Starts a query of one or more log groups using CloudWatch Logs Insights. You specify the log groups and time range to query and the query string to use.

For more information, see CloudWatch Logs Insights Query Syntax.

After you run a query using StartQuery, the query results are stored by CloudWatch Logs. You can use GetQueryResults to retrieve the results of a query, using the queryId that StartQuery returns.

To specify the log groups to query, a StartQuery operation must include one of the following:

  • Either exactly one of the following parameters: logGroupName, logGroupNames, or logGroupIdentifiers

  • Or the queryString must include a SOURCE command to select log groups for the query. The SOURCE command can select log groups based on log group name prefix, account ID, and log class.

    For more information about the SOURCE command, see SOURCE.

If you have associated a KMS key with the query results in this account, then StartQuery uses that key to encrypt the results when it stores them. If no key is associated with query results, the query results are encrypted with the default CloudWatch Logs encryption method.

Queries time out after 60 minutes of runtime. If your queries are timing out, reduce the time range being searched or partition your query into a number of queries.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account to start a query in a linked source account. For more information, see CloudWatch cross-account observability. For a cross-account StartQuery operation, the query definition must be defined in the monitoring account.

You can have up to 30 concurrent CloudWatch Logs insights queries, including queries that have been added to dashboards.

Parameter Syntax

$result = $client->startQuery([
    'endTime' => <integer>, // REQUIRED
    'limit' => <integer>,
    'logGroupIdentifiers' => ['<string>', ...],
    'logGroupName' => '<string>',
    'logGroupNames' => ['<string>', ...],
    'queryLanguage' => 'CWLI|SQL|PPL',
    'queryString' => '<string>', // REQUIRED
    'startTime' => <integer>, // REQUIRED
]);

Parameter Details

Members
endTime
Required: Yes
Type: long (int|float)

The end of the time range to query. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

limit
Type: int

The maximum number of log events to return in the query. If the query string uses the fields command, only the specified fields and their values are returned. The default is 10,000.

logGroupIdentifiers
Type: Array of strings

The list of log groups to query. You can include up to 50 log groups.

You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also be defined in the monitoring account.

If you specify an ARN, use the format arn:aws:logs:region:account-id:log-group:log_group_name Don't include an * at the end.

A StartQuery operation must include exactly one of the following parameters: logGroupName, logGroupNames, or logGroupIdentifiers. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the querystring instead of here.

logGroupName
Type: string

The log group on which to perform the query.

A StartQuery operation must include exactly one of the following parameters: logGroupName, logGroupNames, or logGroupIdentifiers. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the querystring instead of here.

logGroupNames
Type: Array of strings

The list of log groups to be queried. You can include up to 50 log groups.

A StartQuery operation must include exactly one of the following parameters: logGroupName, logGroupNames, or logGroupIdentifiers. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the querystring instead of here.

queryLanguage
Type: string

Specify the query language to use for this query. The options are Logs Insights QL, OpenSearch PPL, and OpenSearch SQL. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

queryString
Required: Yes
Type: string

The query string to use. For more information, see CloudWatch Logs Insights Query Syntax.

startTime
Required: Yes
Type: long (int|float)

The beginning of the time range to query. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

Result Syntax

[
    'queryId' => '<string>',
]

Result Details

Members
queryId
Type: string

The unique ID of the query.

Errors

MalformedQueryException:

The query string is not valid. Details about this error are displayed in a QueryCompileError object. For more information, see QueryCompileError.

For more information about valid query syntax, see CloudWatch Logs Insights Query Syntax.

InvalidParameterException:

A parameter is specified incorrectly.

LimitExceededException:

You have reached the maximum number of resources that can be created.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

StopQuery

$result = $client->stopQuery([/* ... */]);
$promise = $client->stopQueryAsync([/* ... */]);

Stops a CloudWatch Logs Insights query that is in progress. If the query has already ended, the operation returns an error indicating that the specified query is not running.

Parameter Syntax

$result = $client->stopQuery([
    'queryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
queryId
Required: Yes
Type: string

The ID number of the query to stop. To find this ID number, use DescribeQueries.

Result Syntax

[
    'success' => true || false,
]

Result Details

Members
success
Type: boolean

This is true if the query was stopped by the StopQuery operation.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

TagLogGroup

$result = $client->tagLogGroup([/* ... */]);
$promise = $client->tagLogGroupAsync([/* ... */]);

The TagLogGroup operation is on the path to deprecation. We recommend that you use TagResource instead.

Adds or updates the specified tags for the specified log group.

To list the tags for a log group, use ListTagsForResource. To remove tags, use UntagResource.

For more information about tags, see Tag Log Groups in Amazon CloudWatch Logs in the Amazon CloudWatch Logs User Guide.

CloudWatch Logs doesn't support IAM policies that prevent users from assigning specified tags to log groups using the aws:Resource/key-name or aws:TagKeys condition keys. For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.

Parameter Syntax

$result = $client->tagLogGroup([
    'logGroupName' => '<string>', // REQUIRED
    'tags' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

tags
Required: Yes
Type: Associative array of custom strings keys (TagKey) to strings

The key-value pairs to use for the tags.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified resource does not exist.

InvalidParameterException:

A parameter is specified incorrectly.

TagResource

$result = $client->tagResource([/* ... */]);
$promise = $client->tagResourceAsync([/* ... */]);

Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs resource. Currently, the only CloudWatch Logs resources that can be tagged are log groups and destinations.

Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.

Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.

You can use the TagResource action with a resource that already has tags. If you specify a new tag key for the alarm, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces the previous value for that tag.

You can associate as many as 50 tags with a CloudWatch Logs resource.

Parameter Syntax

$result = $client->tagResource([
    'resourceArn' => '<string>', // REQUIRED
    'tags' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
resourceArn
Required: Yes
Type: string

The ARN of the resource that you're adding tags to.

The ARN format of a log group is arn:aws:logs:Region:account-id:log-group:log-group-name

The ARN format of a destination is arn:aws:logs:Region:account-id:destination:destination-name

For more information about ARN format, see CloudWatch Logs resources and operations.

tags
Required: Yes
Type: Associative array of custom strings keys (TagKey) to strings

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

TooManyTagsException:

A resource can have no more than 50 tags.

TestMetricFilter

$result = $client->testMetricFilter([/* ... */]);
$promise = $client->testMetricFilterAsync([/* ... */]);

Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.

Parameter Syntax

$result = $client->testMetricFilter([
    'filterPattern' => '<string>', // REQUIRED
    'logEventMessages' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
filterPattern
Required: Yes
Type: string

A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

logEventMessages
Required: Yes
Type: Array of strings

The log event messages to test.

Result Syntax

[
    'matches' => [
        [
            'eventMessage' => '<string>',
            'eventNumber' => <integer>,
            'extractedValues' => ['<string>', ...],
        ],
        // ...
    ],
]

Result Details

Members
matches
Type: Array of MetricFilterMatchRecord structures

The matched events.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

TestTransformer

$result = $client->testTransformer([/* ... */]);
$promise = $client->testTransformerAsync([/* ... */]);

Use this operation to test a log transformer. You enter the transformer configuration and a set of log events to test with. The operation responds with an array that includes the original log events and the transformed versions.

Parameter Syntax

$result = $client->testTransformer([
    'logEventMessages' => ['<string>', ...], // REQUIRED
    'transformerConfig' => [ // REQUIRED
        [
            'addKeys' => [
                'entries' => [ // REQUIRED
                    [
                        'key' => '<string>', // REQUIRED
                        'overwriteIfExists' => true || false,
                        'value' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'copyValue' => [
                'entries' => [ // REQUIRED
                    [
                        'overwriteIfExists' => true || false,
                        'source' => '<string>', // REQUIRED
                        'target' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'csv' => [
                'columns' => ['<string>', ...],
                'delimiter' => '<string>',
                'quoteCharacter' => '<string>',
                'source' => '<string>',
            ],
            'dateTimeConverter' => [
                'locale' => '<string>',
                'matchPatterns' => ['<string>', ...], // REQUIRED
                'source' => '<string>', // REQUIRED
                'sourceTimezone' => '<string>',
                'target' => '<string>', // REQUIRED
                'targetFormat' => '<string>',
                'targetTimezone' => '<string>',
            ],
            'deleteKeys' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
            'grok' => [
                'match' => '<string>', // REQUIRED
                'source' => '<string>',
            ],
            'listToMap' => [
                'flatten' => true || false,
                'flattenedElement' => 'first|last',
                'key' => '<string>', // REQUIRED
                'source' => '<string>', // REQUIRED
                'target' => '<string>',
                'valueKey' => '<string>',
            ],
            'lowerCaseString' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
            'moveKeys' => [
                'entries' => [ // REQUIRED
                    [
                        'overwriteIfExists' => true || false,
                        'source' => '<string>', // REQUIRED
                        'target' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'parseCloudfront' => [
                'source' => '<string>',
            ],
            'parseJSON' => [
                'destination' => '<string>',
                'source' => '<string>',
            ],
            'parseKeyValue' => [
                'destination' => '<string>',
                'fieldDelimiter' => '<string>',
                'keyPrefix' => '<string>',
                'keyValueDelimiter' => '<string>',
                'nonMatchValue' => '<string>',
                'overwriteIfExists' => true || false,
                'source' => '<string>',
            ],
            'parsePostgres' => [
                'source' => '<string>',
            ],
            'parseRoute53' => [
                'source' => '<string>',
            ],
            'parseVPC' => [
                'source' => '<string>',
            ],
            'parseWAF' => [
                'source' => '<string>',
            ],
            'renameKeys' => [
                'entries' => [ // REQUIRED
                    [
                        'key' => '<string>', // REQUIRED
                        'overwriteIfExists' => true || false,
                        'renameTo' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'splitString' => [
                'entries' => [ // REQUIRED
                    [
                        'delimiter' => '<string>', // REQUIRED
                        'source' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'substituteString' => [
                'entries' => [ // REQUIRED
                    [
                        'from' => '<string>', // REQUIRED
                        'source' => '<string>', // REQUIRED
                        'to' => '<string>', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'trimString' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
            'typeConverter' => [
                'entries' => [ // REQUIRED
                    [
                        'key' => '<string>', // REQUIRED
                        'type' => 'boolean|integer|double|string', // REQUIRED
                    ],
                    // ...
                ],
            ],
            'upperCaseString' => [
                'withKeys' => ['<string>', ...], // REQUIRED
            ],
        ],
        // ...
    ],
]);

Parameter Details

Members
logEventMessages
Required: Yes
Type: Array of strings

An array of the raw log events that you want to use to test this transformer.

transformerConfig
Required: Yes
Type: Array of Processor structures

This structure contains the configuration of this log transformer that you want to test. A log transformer is an array of processors, where each processor applies one type of transformation to the log events that are ingested.

Result Syntax

[
    'transformedLogs' => [
        [
            'eventMessage' => '<string>',
            'eventNumber' => <integer>,
            'transformedEventMessage' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
transformedLogs
Type: Array of TransformedLogRecord structures

An array where each member of the array includes both the original version and the transformed version of one of the log events that you input.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ServiceUnavailableException:

The service cannot complete the request.

InvalidOperationException:

The operation is not valid on the specified resource.

UntagLogGroup

$result = $client->untagLogGroup([/* ... */]);
$promise = $client->untagLogGroupAsync([/* ... */]);

The UntagLogGroup operation is on the path to deprecation. We recommend that you use UntagResource instead.

Removes the specified tags from the specified log group.

To list the tags for a log group, use ListTagsForResource. To add tags, use TagResource.

CloudWatch Logs doesn't support IAM policies that prevent users from assigning specified tags to log groups using the aws:Resource/key-name or aws:TagKeys condition keys.

Parameter Syntax

$result = $client->untagLogGroup([
    'logGroupName' => '<string>', // REQUIRED
    'tags' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
logGroupName
Required: Yes
Type: string

The name of the log group.

tags
Required: Yes
Type: Array of strings

The tag keys. The corresponding tags are removed from the log group.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified resource does not exist.

UntagResource

$result = $client->untagResource([/* ... */]);
$promise = $client->untagResourceAsync([/* ... */]);

Removes one or more tags from the specified resource.

Parameter Syntax

$result = $client->untagResource([
    'resourceArn' => '<string>', // REQUIRED
    'tagKeys' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
resourceArn
Required: Yes
Type: string

The ARN of the CloudWatch Logs resource that you're removing tags from.

The ARN format of a log group is arn:aws:logs:Region:account-id:log-group:log-group-name

The ARN format of a destination is arn:aws:logs:Region:account-id:destination:destination-name

For more information about ARN format, see CloudWatch Logs resources and operations.

tagKeys
Required: Yes
Type: Array of strings

The list of tag keys to remove from the resource.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

UpdateAnomaly

$result = $client->updateAnomaly([/* ... */]);
$promise = $client->updateAnomalyAsync([/* ... */]);

Use this operation to suppress anomaly detection for a specified anomaly or pattern. If you suppress an anomaly, CloudWatch Logs won't report new occurrences of that anomaly and won't update that anomaly with new data. If you suppress a pattern, CloudWatch Logs won't report any anomalies related to that pattern.

You must specify either anomalyId or patternId, but you can't specify both parameters in the same operation.

If you have previously used this operation to suppress detection of a pattern or anomaly, you can use it again to cause CloudWatch Logs to end the suppression. To do this, use this operation and specify the anomaly or pattern to stop suppressing, and omit the suppressionType and suppressionPeriod parameters.

Parameter Syntax

$result = $client->updateAnomaly([
    'anomalyDetectorArn' => '<string>', // REQUIRED
    'anomalyId' => '<string>',
    'baseline' => true || false,
    'patternId' => '<string>',
    'suppressionPeriod' => [
        'suppressionUnit' => 'SECONDS|MINUTES|HOURS',
        'value' => <integer>,
    ],
    'suppressionType' => 'LIMITED|INFINITE',
]);

Parameter Details

Members
anomalyDetectorArn
Required: Yes
Type: string

The ARN of the anomaly detector that this operation is to act on.

anomalyId
Type: string

If you are suppressing or unsuppressing an anomaly, specify its unique ID here. You can find anomaly IDs by using the ListAnomalies operation.

baseline
Type: boolean

Set this to true to prevent CloudWatch Logs from displaying this behavior as an anomaly in the future. The behavior is then treated as baseline behavior. However, if similar but more severe occurrences of this behavior occur in the future, those will still be reported as anomalies.

The default is false

patternId
Type: string

If you are suppressing or unsuppressing an pattern, specify its unique ID here. You can find pattern IDs by using the ListAnomalies operation.

suppressionPeriod
Type: SuppressionPeriod structure

If you are temporarily suppressing an anomaly or pattern, use this structure to specify how long the suppression is to last.

suppressionType
Type: string

Use this to specify whether the suppression to be temporary or infinite. If you specify LIMITED, you must also specify a suppressionPeriod. If you specify INFINITE, any value for suppressionPeriod is ignored.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

UpdateDeliveryConfiguration

$result = $client->updateDeliveryConfiguration([/* ... */]);
$promise = $client->updateDeliveryConfigurationAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->updateDeliveryConfiguration([
    'fieldDelimiter' => '<string>',
    'id' => '<string>', // REQUIRED
    'recordFields' => ['<string>', ...],
    's3DeliveryConfiguration' => [
        'enableHiveCompatiblePath' => true || false,
        'suffixPath' => '<string>',
    ],
]);

Parameter Details

Members
fieldDelimiter
Type: string

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

id
Required: Yes
Type: string

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

recordFields
Type: Array of strings

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.

s3DeliveryConfiguration
Type: S3DeliveryConfiguration structure

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ServiceUnavailableException:

The service cannot complete the request.

ConflictException:

This operation attempted to create a resource that already exists.

ResourceNotFoundException:

The specified resource does not exist.

ValidationException:

One of the parameters for the request is not valid.

AccessDeniedException:

You don't have sufficient permissions to perform this action.

ThrottlingException:

The request was throttled because of quota limits.

UpdateLogAnomalyDetector

$result = $client->updateLogAnomalyDetector([/* ... */]);
$promise = $client->updateLogAnomalyDetectorAsync([/* ... */]);

Updates an existing log anomaly detector.

Parameter Syntax

$result = $client->updateLogAnomalyDetector([
    'anomalyDetectorArn' => '<string>', // REQUIRED
    'anomalyVisibilityTime' => <integer>,
    'enabled' => true || false, // REQUIRED
    'evaluationFrequency' => 'ONE_MIN|FIVE_MIN|TEN_MIN|FIFTEEN_MIN|THIRTY_MIN|ONE_HOUR',
    'filterPattern' => '<string>',
]);

Parameter Details

Members
anomalyDetectorArn
Required: Yes
Type: string

The ARN of the anomaly detector that you want to update.

anomalyVisibilityTime
Type: long (int|float)

The number of days to use as the life cycle of anomalies. After this time, anomalies are automatically baselined and the anomaly detector model will treat new occurrences of similar event as normal. Therefore, if you do not correct the cause of an anomaly during this time, it will be considered normal going forward and will not be detected.

enabled
Required: Yes
Type: boolean

Use this parameter to pause or restart the anomaly detector.

evaluationFrequency
Type: string

Specifies how often the anomaly detector runs and look for anomalies. Set this value according to the frequency that the log group receives new logs. For example, if the log group receives new log events every 10 minutes, then setting evaluationFrequency to FIFTEEN_MIN might be appropriate.

filterPattern
Type: string

A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

A parameter is specified incorrectly.

ResourceNotFoundException:

The specified resource does not exist.

ServiceUnavailableException:

The service cannot complete the request.

OperationAbortedException:

Multiple concurrent requests to update the same resource were in conflict.

Shapes

AccessDeniedException

Description

You don't have sufficient permissions to perform this action.

Members

AccountPolicy

Description

A structure that contains information about one CloudWatch Logs account policy.

Members
accountId
Type: string

The Amazon Web Services account ID that the policy applies to.

lastUpdatedTime
Type: long (int|float)

The date and time that this policy was most recently updated.

policyDocument
Type: string

The policy document for this account policy.

The JSON specified in policyDocument can be up to 30,720 characters.

policyName
Type: string

The name of the account policy.

policyType
Type: string

The type of policy for this account policy.

scope
Type: string

The scope of the account policy.

selectionCriteria
Type: string

The log group selection criteria that is used for this policy.

AddKeyEntry

Description

This object defines one key that will be added with the addKeys processor.

Members
key
Required: Yes
Type: string

The key of the new entry to be added to the log event

overwriteIfExists
Type: boolean

Specifies whether to overwrite the value if the key already exists in the log event. If you omit this, the default is false.

value
Required: Yes
Type: string

The value of the new entry to be added to the log event

AddKeys

Description

This processor adds new key-value pairs to the log event.

For more information about this processor including examples, see addKeys in the CloudWatch Logs User Guide.

Members
entries
Required: Yes
Type: Array of AddKeyEntry structures

An array of objects, where each object contains the information about one key to add to the log event.

Anomaly

Description

This structure represents one anomaly that has been found by a logs anomaly detector.

For more information about patterns and anomalies, see CreateLogAnomalyDetector.

Members
active
Required: Yes
Type: boolean

Specifies whether this anomaly is still ongoing.

anomalyDetectorArn
Required: Yes
Type: string

The ARN of the anomaly detector that identified this anomaly.

anomalyId
Required: Yes
Type: string

The unique ID that CloudWatch Logs assigned to this anomaly.

description
Required: Yes
Type: string

A human-readable description of the anomaly. This description is generated by CloudWatch Logs.

firstSeen
Required: Yes
Type: long (int|float)

The date and time when the anomaly detector first saw this anomaly. It is specified as epoch time, which is the number of seconds since January 1, 1970, 00:00:00 UTC.

histogram
Required: Yes
Type: Associative array of custom strings keys (Time) to long (int|float)s

A map showing times when the anomaly detector ran, and the number of occurrences of this anomaly that were detected at each of those runs. The times are specified in epoch time, which is the number of seconds since January 1, 1970, 00:00:00 UTC.

isPatternLevelSuppression
Type: boolean

If this anomaly is suppressed, this field is true if the suppression is because the pattern is suppressed. If false, then only this particular anomaly is suppressed.

lastSeen
Required: Yes
Type: long (int|float)

The date and time when the anomaly detector most recently saw this anomaly. It is specified as epoch time, which is the number of seconds since January 1, 1970, 00:00:00 UTC.

logGroupArnList
Required: Yes
Type: Array of strings

An array of ARNS of the log groups that contained log events considered to be part of this anomaly.

logSamples
Required: Yes
Type: Array of LogEvent structures

An array of sample log event messages that are considered to be part of this anomaly.

patternId
Required: Yes
Type: string

The ID of the pattern used to help identify this anomaly.

patternRegex
Type: string

The pattern used to help identify this anomaly, in regular expression format.

patternString
Required: Yes
Type: string

The pattern used to help identify this anomaly, in string format.

patternTokens
Required: Yes
Type: Array of PatternToken structures

An array of structures where each structure contains information about one token that makes up the pattern.

priority
Type: string

The priority level of this anomaly, as determined by CloudWatch Logs. Priority is computed based on log severity labels such as FATAL and ERROR and the amount of deviation from the baseline. Possible values are HIGH, MEDIUM, and LOW.

state
Required: Yes
Type: string

Indicates the current state of this anomaly. If it is still being treated as an anomaly, the value is Active. If you have suppressed this anomaly by using the UpdateAnomaly operation, the value is Suppressed. If this behavior is now considered to be normal, the value is Baseline.

suppressed
Type: boolean

Indicates whether this anomaly is currently suppressed. To suppress an anomaly, use UpdateAnomaly.

suppressedDate
Type: long (int|float)

If the anomaly is suppressed, this indicates when it was suppressed.

suppressedUntil
Type: long (int|float)

If the anomaly is suppressed, this indicates when the suppression will end. If this value is 0, the anomaly was suppressed with no expiration, with the INFINITE value.

AnomalyDetector

Description

Contains information about one anomaly detector in the account.

Members
anomalyDetectorArn
Type: string

The ARN of the anomaly detector.

anomalyDetectorStatus
Type: string

Specifies the current status of the anomaly detector. To pause an anomaly detector, use the enabled parameter in the UpdateLogAnomalyDetector operation.

anomalyVisibilityTime
Type: long (int|float)

The number of days used as the life cycle of anomalies. After this time, anomalies are automatically baselined and the anomaly detector model will treat new occurrences of similar event as normal.

creationTimeStamp
Type: long (int|float)

The date and time when this anomaly detector was created.

detectorName
Type: string

The name of the anomaly detector.

evaluationFrequency
Type: string

Specifies how often the anomaly detector runs and look for anomalies.

filterPattern
Type: string

A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

kmsKeyId
Type: string

The ID of the KMS key assigned to this anomaly detector, if any.

lastModifiedTimeStamp
Type: long (int|float)

The date and time when this anomaly detector was most recently modified.

logGroupArnList
Type: Array of strings

A list of the ARNs of the log groups that this anomaly detector watches.

CSV

Description

The CSV processor parses comma-separated values (CSV) from the log events into columns.

For more information about this processor including examples, see csv in the CloudWatch Logs User Guide.

Members
columns
Type: Array of strings

An array of names to use for the columns in the transformed log event.

If you omit this, default column names ([column_1, column_2 ...]) are used.

delimiter
Type: string

The character used to separate each column in the original comma-separated value log event. If you omit this, the processor looks for the comma , character as the delimiter.

quoteCharacter
Type: string

The character used used as a text qualifier for a single column of data. If you omit this, the double quotation mark " character is used.

source
Type: string

The path to the field in the log event that has the comma separated values to be parsed. If you omit this value, the whole log message is processed.

ConfigurationTemplate

Description

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

Members
allowedActionForAllowVendedLogsDeliveryForResource
Type: 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
Type: Array of strings

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.

allowedFields
Type: Array of RecordField structures

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

allowedOutputFormats
Type: Array of strings

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

allowedSuffixPathFields
Type: Array of strings

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

defaultDeliveryConfigValues

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

deliveryDestinationType
Type: string

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

logType
Type: string

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

resourceType
Type: string

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

service
Type: 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..

ConfigurationTemplateDeliveryConfigValues

Description

This structure contains the default values that are used for each configuration parameter when you use CreateDelivery to create a deliver under the current service type, resource type, and log type.

Members
fieldDelimiter
Type: 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.

recordFields
Type: Array of strings

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

s3DeliveryConfiguration
Type: S3DeliveryConfiguration structure

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

ConflictException

Description

This operation attempted to create a resource that already exists.

Members

CopyValue

Description

This processor copies values within a log event. You can also use this processor to add metadata to log events by copying the values of the following metadata keys into the log events: @logGroupName, @logGroupStream, @accountId, @regionName.

For more information about this processor including examples, see copyValue in the CloudWatch Logs User Guide.

Members
entries
Required: Yes
Type: Array of CopyValueEntry structures

An array of CopyValueEntry objects, where each object contains the information about one field value to copy.

CopyValueEntry

Description

This object defines one value to be copied with the copyValue processor.

Members
overwriteIfExists
Type: boolean

Specifies whether to overwrite the value if the destination key already exists. If you omit this, the default is false.

source
Required: Yes
Type: string

The key to copy.

target
Required: Yes
Type: string

The key of the field to copy the value to.

DataAlreadyAcceptedException

Description

The event was already logged.

PutLogEvents actions are now always accepted and never return DataAlreadyAcceptedException regardless of whether a given batch of log events has already been accepted.

Members
expectedSequenceToken
Type: string

DateTimeConverter

Description

This processor converts a datetime string into a format that you specify.

For more information about this processor including examples, see datetimeConverter in the CloudWatch Logs User Guide.

Members
locale
Type: string

The locale of the source field. If you omit this, the default of locale.ROOT is used.

matchPatterns
Required: Yes
Type: Array of strings

A list of patterns to match against the source field.

source
Required: Yes
Type: string

The key to apply the date conversion to.

sourceTimezone
Type: string

The time zone of the source field. If you omit this, the default used is the UTC zone.

target
Required: Yes
Type: string

The JSON field to store the result in.

targetFormat
Type: string

The datetime format to use for the converted data in the target field.

If you omit this, the default of yyyy-MM-dd'T'HH:mm:ss.SSS'Z is used.

targetTimezone
Type: string

The time zone of the target field. If you omit this, the default used is the UTC zone.

DeleteKeys

Description

This processor deletes entries from a log event. These entries are key-value pairs.

For more information about this processor including examples, see deleteKeys in the CloudWatch Logs User Guide.

Members
withKeys
Required: Yes
Type: Array of strings

The list of keys to delete.

Delivery

Description

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.

To update an existing delivery configuration, use UpdateDeliveryConfiguration.

Members
arn
Type: string

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

deliveryDestinationArn
Type: string

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

deliveryDestinationType
Type: string

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

deliverySourceName
Type: string

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

fieldDelimiter
Type: 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.

id
Type: string

The unique ID that identifies this delivery in your account.

recordFields
Type: Array of strings

The record fields used in this delivery.

s3DeliveryConfiguration
Type: S3DeliveryConfiguration structure

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

tags
Type: Associative array of custom strings keys (TagKey) to strings

The tags that have been assigned to this delivery.

DeliveryDestination

Description

This structure contains information about one delivery destination in your account. A delivery destination is an Amazon Web Services resource that represents an Amazon Web Services service that logs can be sent to. CloudWatch Logs, Amazon S3, are supported as Firehose delivery destinations.

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.

  • 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.

  • Create a delivery by pairing exactly one delivery source and one delivery destination. For more information, see CreateDelivery.

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.

Members
arn
Type: string

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

deliveryDestinationConfiguration

A structure that contains the ARN of the Amazon Web Services resource that will receive the logs.

deliveryDestinationType
Type: string

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

name
Type: string

The name of this delivery destination.

outputFormat
Type: string

The format of the logs that are sent to this delivery destination.

tags
Type: Associative array of custom strings keys (TagKey) to strings

The tags that have been assigned to this delivery destination.

DeliveryDestinationConfiguration

Description

A structure that contains information about one logs delivery destination.

Members
destinationResourceArn
Required: Yes
Type: string

The ARN of the Amazon Web Services destination that this delivery destination represents. That Amazon Web Services destination can be a log group in CloudWatch Logs, an Amazon S3 bucket, or a delivery stream in Firehose.

DeliverySource

Description

This structure contains information about one delivery source in your account. A delivery source is an Amazon Web Services resource that sends logs to an Amazon Web Services 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 as Supported [V2 Permissions] in the table at Enabling logging from Amazon Web Services services.

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.

  • Create a delivery by pairing exactly one delivery source and one delivery destination. For more information, see CreateDelivery.

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.

Members
arn
Type: string

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

logType
Type: string

The type of log that the source is sending. For valid values for this parameter, see the documentation for the source service.

name
Type: string

The unique name of the delivery source.

resourceArns
Type: Array of strings

This array contains the ARN of the Amazon Web Services resource that sends logs and is represented by this delivery source. Currently, only one ARN can be in the array.

service
Type: string

The Amazon Web Services service that is sending logs.

tags
Type: Associative array of custom strings keys (TagKey) to strings

The tags that have been assigned to this delivery source.

Destination

Description

Represents a cross-account destination that receives subscription log events.

Members
accessPolicy
Type: string

An IAM policy document that governs which Amazon Web Services accounts can create subscription filters against this destination.

arn
Type: string

The ARN of this destination.

creationTime
Type: long (int|float)

The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

destinationName
Type: string

The name of the destination.

roleArn
Type: string

A role for impersonation, used when delivering log events to the target.

targetArn
Type: string

The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, a Kinesis stream).

Entity

Description

The entity associated with the log events in a PutLogEvents call.

Members
attributes
Type: Associative array of custom strings keys (EntityAttributesKey) to strings

Additional attributes of the entity that are not used to specify the identity of the entity. A list of key-value pairs.

For details about how to use the attributes, see How to add related information to telemetry in the CloudWatch User Guide.

keyAttributes
Type: Associative array of custom strings keys (EntityKeyAttributesKey) to strings

The attributes of the entity which identify the specific entity, as a list of key-value pairs. Entities with the same keyAttributes are considered to be the same entity.

There are five allowed attributes (key names): Type, ResourceType, Identifier Name, and Environment.

For details about how to use the key attributes, see How to add related information to telemetry in the CloudWatch User Guide.

ExportTask

Description

Represents an export task.

Members
destination
Type: string

The name of the S3 bucket to which the log data was exported.

destinationPrefix
Type: string

The prefix that was used as the start of Amazon S3 key for every object exported.

executionInfo
Type: ExportTaskExecutionInfo structure

Execution information about the export task.

from
Type: long (int|float)

The start time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not exported.

logGroupName
Type: string

The name of the log group from which logs data was exported.

status
Type: ExportTaskStatus structure

The status of the export task.

taskId
Type: string

The ID of the export task.

taskName
Type: string

The name of the export task.

to
Type: long (int|float)

The end time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported.

ExportTaskExecutionInfo

Description

Represents the status of an export task.

Members
completionTime
Type: long (int|float)

The completion time of the export task, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

creationTime
Type: long (int|float)

The creation time of the export task, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

ExportTaskStatus

Description

Represents the status of an export task.

Members
code
Type: string

The status code of the export task.

message
Type: string

The status message related to the status code.

FieldIndex

Description

This structure describes one log event field that is used as an index in at least one index policy in this account.

Members
fieldIndexName
Type: string

The string that this field index matches.

firstEventTime
Type: long (int|float)

The time and date of the earliest log event that matches this field index, after the index policy that contains it was created.

lastEventTime
Type: long (int|float)

The time and date of the most recent log event that matches this field index.

lastScanTime
Type: long (int|float)

The most recent time that CloudWatch Logs scanned ingested log events to search for this field index to improve the speed of future CloudWatch Logs Insights queries that search for this field index.

logGroupIdentifier
Type: string

If this field index appears in an index policy that applies only to a single log group, the ARN of that log group is displayed here.

FilteredLogEvent

Description

Represents a matched event.

Members
eventId
Type: string

The ID of the event.

ingestionTime
Type: long (int|float)

The time the event was ingested, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

logStreamName
Type: string

The name of the log stream to which this event belongs.

message
Type: string

The data contained in the log event.

timestamp
Type: long (int|float)

The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

Grok

Description

This processor uses pattern matching to parse and structure unstructured data. This processor can also extract fields from log messages.

For more information about this processor including examples, see grok in the CloudWatch Logs User Guide.

Members
match
Required: Yes
Type: string

The grok pattern to match against the log event. For a list of supported grok patterns, see Supported grok patterns.

source
Type: string

The path to the field in the log event that you want to parse. If you omit this value, the whole log message is parsed.

IndexPolicy

Description

This structure contains information about one field index policy in this account.

Members
lastUpdateTime
Type: long (int|float)

The date and time that this index policy was most recently updated.

logGroupIdentifier
Type: string

The ARN of the log group that this index policy applies to.

policyDocument
Type: string

The policy document for this index policy, in JSON format.

policyName
Type: string

The name of this policy. Responses about log group-level field index policies don't have this field, because those policies don't have names.

source
Type: string

This field indicates whether this is an account-level index policy or an index policy that applies only to a single log group.

InputLogEvent

Description

Represents a log event, which is a record of activity that was recorded by the application or resource being monitored.

Members
message
Required: Yes
Type: string

The raw event message. Each log event can be no larger than 256 KB.

timestamp
Required: Yes
Type: long (int|float)

The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

IntegrationDetails

Description

This structure contains information about the integration configuration. For an integration with OpenSearch Service, this includes information about OpenSearch Service resources such as the collection, the workspace, and policies.

This structure is returned by a GetIntegration operation.

Members
openSearchIntegrationDetails

This structure contains complete information about one integration between CloudWatch Logs and OpenSearch Service.

IntegrationSummary

Description

This structure contains information about one CloudWatch Logs integration. This structure is returned by a ListIntegrations operation.

Members
integrationName
Type: string

The name of this integration.

integrationStatus
Type: string

The current status of this integration.

integrationType
Type: string

The type of integration. Integrations with OpenSearch Service have the type OPENSEARCH.

InvalidOperationException

Description

The operation is not valid on the specified resource.

Members

InvalidParameterException

Description

A parameter is specified incorrectly.

Members

InvalidSequenceTokenException

Description

The sequence token is not valid. You can get the correct sequence token in the expectedSequenceToken field in the InvalidSequenceTokenException message.

PutLogEvents actions are now always accepted and never return InvalidSequenceTokenException regardless of receiving an invalid sequence token.

Members
expectedSequenceToken
Type: string

LimitExceededException

Description

You have reached the maximum number of resources that can be created.

Members

ListToMap

Description

This processor takes a list of objects that contain key fields, and converts them into a map of target keys.

For more information about this processor including examples, see listToMap in the CloudWatch Logs User Guide.

Members
flatten
Type: boolean

A Boolean value to indicate whether the list will be flattened into single items. Specify true to flatten the list. The default is false

flattenedElement
Type: string

If you set flatten to true, use flattenedElement to specify which element, first or last, to keep.

You must specify this parameter if flatten is true

key
Required: Yes
Type: string

The key of the field to be extracted as keys in the generated map

source
Required: Yes
Type: string

The key in the log event that has a list of objects that will be converted to a map.

target
Type: string

The key of the field that will hold the generated map

valueKey
Type: string

If this is specified, the values that you specify in this parameter will be extracted from the source objects and put into the values of the generated map. Otherwise, original objects in the source list will be put into the values of the generated map.

LiveTailSessionLogEvent

Description

This object contains the information for one log event returned in a Live Tail stream.

Members
ingestionTime
Type: long (int|float)

The timestamp specifying when this log event was ingested into the log group.

logGroupIdentifier
Type: string

The name or ARN of the log group that ingested this log event.

logStreamName
Type: string

The name of the log stream that ingested this log event.

message
Type: string

The log event message text.

timestamp
Type: long (int|float)

The timestamp specifying when this log event was created.

LiveTailSessionMetadata

Description

This object contains the metadata for one LiveTailSessionUpdate structure. It indicates whether that update includes only a sample of 500 log events out of a larger number of ingested log events, or if it contains all of the matching log events ingested during that second of time.

Members
sampled
Type: boolean

If this is true, then more than 500 log events matched the request for this update, and the sessionResults includes a sample of 500 of those events.

If this is false, then 500 or fewer log events matched the request for this update, so no sampling was necessary. In this case, the sessionResults array includes all log events that matched your request during this time.

LiveTailSessionStart

Description

This object contains information about this Live Tail session, including the log groups included and the log stream filters, if any.

Members
logEventFilterPattern
Type: string

An optional pattern to filter the results to include only log events that match the pattern. For example, a filter pattern of error 404 displays only log events that include both error and 404.

For more information about filter pattern syntax, see Filter and Pattern Syntax.

logGroupIdentifiers
Type: Array of strings

An array of the names and ARNs of the log groups included in this Live Tail session.

logStreamNamePrefixes
Type: Array of strings

If your StartLiveTail operation request included a logStreamNamePrefixes parameter that filtered the session to only include log streams that have names that start with certain prefixes, these prefixes are listed here.

logStreamNames
Type: Array of strings

If your StartLiveTail operation request included a logStreamNames parameter that filtered the session to only include certain log streams, these streams are listed here.

requestId
Type: string

The unique ID generated by CloudWatch Logs to identify this Live Tail session request.

sessionId
Type: string

The unique ID generated by CloudWatch Logs to identify this Live Tail session.

LiveTailSessionUpdate

Description

This object contains the log events and metadata for a Live Tail session.

Members
sessionMetadata
Type: LiveTailSessionMetadata structure

This object contains the session metadata for a Live Tail session.

sessionResults
Type: Array of LiveTailSessionLogEvent structures

An array, where each member of the array includes the information for one log event in the Live Tail session.

A sessionResults array can include as many as 500 log events. If the number of log events matching the request exceeds 500 per second, the log events are sampled down to 500 log events to be included in each sessionUpdate structure.

LogEvent

Description

This structure contains the information for one sample log event that is associated with an anomaly found by a log anomaly detector.

Members
message
Type: string

The message content of the log event.

timestamp
Type: long (int|float)

The time stamp of the log event.

LogGroup

Description

Represents a log group.

Members
arn
Type: string

The Amazon Resource Name (ARN) of the log group. This version of the ARN includes a trailing :* after the log group name.

Use this version to refer to the ARN in IAM policies when specifying permissions for most API actions. The exception is when specifying permissions for TagResource, UntagResource, and ListTagsForResource. The permissions for those three actions require the ARN version that doesn't include a trailing :*.

creationTime
Type: long (int|float)

The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

dataProtectionStatus
Type: string

Displays whether this log group has a protection policy, or whether it had one in the past. For more information, see PutDataProtectionPolicy.

inheritedProperties
Type: Array of strings

Displays all the properties that this log group has inherited from account-level settings.

kmsKeyId
Type: string

The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data.

logGroupArn
Type: string

The Amazon Resource Name (ARN) of the log group. This version of the ARN doesn't include a trailing :* after the log group name.

Use this version to refer to the ARN in the following situations:

logGroupClass
Type: string

This specifies the log group class for this log group. There are two classes:

  • The Standard log class supports all CloudWatch Logs features.

  • The Infrequent Access log class supports a subset of CloudWatch Logs features and incurs lower costs.

For details about the features supported by each class, see Log classes

logGroupName
Type: string

The name of the log group.

metricFilterCount
Type: int

The number of metric filters.

retentionInDays
Type: int

The number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, and 3653.

To set a log group so that its log events do not expire, use DeleteRetentionPolicy.

storedBytes
Type: long (int|float)

The number of bytes stored.

LogGroupField

Description

The fields contained in log events found by a GetLogGroupFields operation, along with the percentage of queried log events in which each field appears.

Members
name
Type: string

The name of a log field.

percent
Type: int

The percentage of log events queried that contained the field.

LogStream

Description

Represents a log stream, which is a sequence of log events from a single emitter of logs.

Members
arn
Type: string

The Amazon Resource Name (ARN) of the log stream.

creationTime
Type: long (int|float)

The creation time of the stream, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

firstEventTimestamp
Type: long (int|float)

The time of the first event, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

lastEventTimestamp
Type: long (int|float)

The time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. The lastEventTime value updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.

lastIngestionTime
Type: long (int|float)

The ingestion time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC The lastIngestionTime value updates on an eventual consistency basis. It typically updates in less than an hour after ingestion, but in rare situations might take longer.

logStreamName
Type: string

The name of the log stream.

storedBytes
Type: long (int|float)

The number of bytes stored.

Important: As of June 17, 2019, this parameter is no longer supported for log streams, and is always reported as zero. This change applies only to log streams. The storedBytes parameter for log groups is not affected.

uploadSequenceToken
Type: string

The sequence token.

The sequence token is now ignored in PutLogEvents actions. PutLogEvents actions are always accepted regardless of receiving an invalid sequence token. You don't need to obtain uploadSequenceToken to use a PutLogEvents action.

LowerCaseString

Description

This processor converts a string to lowercase.

For more information about this processor including examples, see lowerCaseString in the CloudWatch Logs User Guide.

Members
withKeys
Required: Yes
Type: Array of strings

The array caontaining the keys of the fields to convert to lowercase.

MetricFilter

Description

Metric filters express how CloudWatch Logs would extract metric observations from ingested log events and transform them into metric data in a CloudWatch metric.

Members
applyOnTransformedLogs
Type: boolean

This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see PutTransformer.

If this value is true, the metric filter is applied on the transformed version of the log events instead of the original ingested log events.

creationTime
Type: long (int|float)

The creation time of the metric filter, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

filterName
Type: string

The name of the metric filter.

filterPattern
Type: string

A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

logGroupName
Type: string

The name of the log group.

metricTransformations
Type: Array of MetricTransformation structures

The metric transformations.

MetricFilterMatchRecord

Description

Represents a matched event.

Members
eventMessage
Type: string

The raw event data.

eventNumber
Type: long (int|float)

The event number.

extractedValues
Type: Associative array of custom strings keys (Token) to strings

The values extracted from the event data by the filter.

MetricTransformation

Description

Indicates how to transform ingested log events to metric data in a CloudWatch metric.

Members
defaultValue
Type: double

(Optional) The value to emit when a filter pattern does not match a log event. This value can be null.

dimensions
Type: Associative array of custom strings keys (DimensionsKey) to strings

The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.

Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress or requestID as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

CloudWatch Logs disables a metric filter if it generates 1000 different name/value pairs for your specified dimensions within a certain amount of time. This helps to prevent accidental high charges.

You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges.

metricName
Required: Yes
Type: string

The name of the CloudWatch metric.

metricNamespace
Required: Yes
Type: string

A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.

metricValue
Required: Yes
Type: string

The value to publish to the CloudWatch metric when a filter pattern matches a log event.

unit
Type: string

The unit to assign to the metric. If you omit this, the unit is set as None.

MoveKeyEntry

Description

This object defines one key that will be moved with the moveKey processor.

Members
overwriteIfExists
Type: boolean

Specifies whether to overwrite the value if the destination key already exists. If you omit this, the default is false.

source
Required: Yes
Type: string

The key to move.

target
Required: Yes
Type: string

The key to move to.

MoveKeys

Description

This processor moves a key from one field to another. The original key is deleted.

For more information about this processor including examples, see moveKeys in the CloudWatch Logs User Guide.

Members
entries
Required: Yes
Type: Array of MoveKeyEntry structures

An array of objects, where each object contains the information about one key to move.

OpenSearchApplication

Description

This structure contains information about the OpenSearch Service application used for this integration. An OpenSearch Service application is the web application created by the integration with CloudWatch Logs. It hosts the vended logs dashboards.

Members
applicationArn
Type: string

The Amazon Resource Name (ARN) of the application.

applicationEndpoint
Type: string

The endpoint of the application.

applicationId
Type: string

The ID of the application.

status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of this OpenSearch Service resource.

OpenSearchCollection

Description

This structure contains information about the OpenSearch Service collection used for this integration. An OpenSearch Service collection is a logical grouping of one or more indexes that represent an analytics workload. For more information, see Creating and managing OpenSearch Service Serverless collections.

Members
collectionArn
Type: string

The ARN of the collection.

collectionEndpoint
Type: string

The endpoint of the collection.

status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of this OpenSearch Service resource.

OpenSearchDataAccessPolicy

Description

This structure contains information about the OpenSearch Service data access policy used for this integration. The access policy defines the access controls for the collection. This data access policy was automatically created as part of the integration setup. For more information about OpenSearch Service data access policies, see Data access control for Amazon OpenSearch Serverless in the OpenSearch Service Developer Guide.

Members
policyName
Type: string

The name of the data access policy.

status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of this OpenSearch Service resource.

OpenSearchDataSource

Description

This structure contains information about the OpenSearch Service data source used for this integration. This data source was created as part of the integration setup. An OpenSearch Service data source defines the source and destination for OpenSearch Service queries. It includes the role required to execute queries and write to collections.

For more information about OpenSearch Service data sources , see Creating OpenSearch Service data source integrations with Amazon S3.

Members
dataSourceName
Type: string

The name of the OpenSearch Service data source.

status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of this OpenSearch Service resource.

OpenSearchEncryptionPolicy

Description

This structure contains information about the OpenSearch Service encryption policy used for this integration. The encryption policy was created automatically when you created the integration. For more information, see Encryption policies in the OpenSearch Service Developer Guide.

Members
policyName
Type: string

The name of the encryption policy.

status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of this OpenSearch Service resource.

OpenSearchIntegrationDetails

Description

This structure contains complete information about one CloudWatch Logs integration. This structure is returned by a GetIntegration operation.

Members
accessPolicy
Type: OpenSearchDataAccessPolicy structure

This structure contains information about the OpenSearch Service data access policy used for this integration. The access policy defines the access controls for the collection. This data access policy was automatically created as part of the integration setup. For more information about OpenSearch Service data access policies, see Data access control for Amazon OpenSearch Serverless in the OpenSearch Service Developer Guide.

application
Type: OpenSearchApplication structure

This structure contains information about the OpenSearch Service application used for this integration. An OpenSearch Service application is the web application that was created by the integration with CloudWatch Logs. It hosts the vended logs dashboards.

collection
Type: OpenSearchCollection structure

This structure contains information about the OpenSearch Service collection used for this integration. This collection was created as part of the integration setup. An OpenSearch Service collection is a logical grouping of one or more indexes that represent an analytics workload. For more information, see Creating and managing OpenSearch Service Serverless collections.

dataSource
Type: OpenSearchDataSource structure

This structure contains information about the OpenSearch Service data source used for this integration. This data source was created as part of the integration setup. An OpenSearch Service data source defines the source and destination for OpenSearch Service queries. It includes the role required to execute queries and write to collections.

For more information about OpenSearch Service data sources , see Creating OpenSearch Service data source integrations with Amazon S3.

encryptionPolicy
Type: OpenSearchEncryptionPolicy structure

This structure contains information about the OpenSearch Service encryption policy used for this integration. The encryption policy was created automatically when you created the integration. For more information, see Encryption policies in the OpenSearch Service Developer Guide.

lifecyclePolicy
Type: OpenSearchLifecyclePolicy structure

This structure contains information about the OpenSearch Service data lifecycle policy used for this integration. The lifecycle policy determines the lifespan of the data in the collection. It was automatically created as part of the integration setup.

For more information, see Using data lifecycle policies with OpenSearch Service Serverless in the OpenSearch Service Developer Guide.

networkPolicy
Type: OpenSearchNetworkPolicy structure

This structure contains information about the OpenSearch Service network policy used for this integration. The network policy assigns network access settings to collections. For more information, see Network policies in the OpenSearch Service Developer Guide.

workspace
Type: OpenSearchWorkspace structure

This structure contains information about the OpenSearch Service workspace used for this integration. An OpenSearch Service workspace is the collection of dashboards along with other OpenSearch Service tools. This workspace was created automatically as part of the integration setup. For more information, see Centralized OpenSearch user interface (Dashboards) with OpenSearch Service.

OpenSearchLifecyclePolicy

Description

This structure contains information about the OpenSearch Service data lifecycle policy used for this integration. The lifecycle policy determines the lifespan of the data in the collection. It was automatically created as part of the integration setup.

For more information, see Using data lifecycle policies with OpenSearch Service Serverless in the OpenSearch Service Developer Guide.

Members
policyName
Type: string

The name of the lifecycle policy.

status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of this OpenSearch Service resource.

OpenSearchNetworkPolicy

Description

This structure contains information about the OpenSearch Service network policy used for this integration. The network policy assigns network access settings to collections. For more information, see Network policies in the OpenSearch Service Developer Guide.

Members
policyName
Type: string

The name of the network policy.

status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of this OpenSearch Service resource.

OpenSearchResourceConfig

Description

This structure contains configuration details about an integration between CloudWatch Logs and OpenSearch Service.

Members
applicationArn
Type: string

If you want to use an existing OpenSearch Service application for your integration with OpenSearch Service, specify it here. If you omit this, a new application will be created.

dashboardViewerPrincipals
Required: Yes
Type: Array of strings

Specify the ARNs of IAM roles and IAM users who you want to grant permission to for viewing the dashboards.

In addition to specifying these users here, you must also grant them the CloudWatchOpenSearchDashboardsAccess IAM policy. For more information, see

dataSourceRoleArn
Required: Yes
Type: string

Specify the ARN of an IAM role that CloudWatch Logs will use to create the integration. This role must have the permissions necessary to access the OpenSearch Service collection to be able to create the dashboards. For more information about the permissions needed, see Create an IAM role to access the OpenSearch Service collection in the CloudWatch Logs User Guide.

kmsKeyArn
Type: string

To have the vended dashboard data encrypted with KMS instead of the CloudWatch Logs default encryption method, specify the ARN of the KMS key that you want to use.

retentionDays
Required: Yes
Type: int

Specify how many days that you want the data derived by OpenSearch Service to be retained in the index that the dashboard refers to. This also sets the maximum time period that you can choose when viewing data in the dashboard. Choosing a longer time frame will incur additional costs.

OpenSearchResourceStatus

Description

This structure contains information about the status of an OpenSearch Service resource.

Members
status
Type: string

The current status of this resource.

statusMessage
Type: string

A message with additional information about the status of this resource.

OpenSearchWorkspace

Description

This structure contains information about the OpenSearch Service workspace used for this integration. An OpenSearch Service workspace is the collection of dashboards along with other OpenSearch Service tools. This workspace was created automatically as part of the integration setup. For more information, see Centralized OpenSearch user interface (Dashboards) with OpenSearch Service.

Members
status
Type: OpenSearchResourceStatus structure

This structure contains information about the status of an OpenSearch Service resource.

workspaceId
Type: string

The ID of this workspace.

OperationAbortedException

Description

Multiple concurrent requests to update the same resource were in conflict.

Members

OutputLogEvent

Description

Represents a log event.

Members
ingestionTime
Type: long (int|float)

The time the event was ingested, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

message
Type: string

The data contained in the log event.

timestamp
Type: long (int|float)

The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

ParseCloudfront

Description

This processor parses CloudFront vended logs, extract fields, and convert them into JSON format. Encoded field values are decoded. Values that are integers and doubles are treated as such. For more information about this processor including examples, see parseCloudfront

For more information about CloudFront log format, see Configure and use standard logs (access logs).

If you use this processor, it must be the first processor in your transformer.

Members
source
Type: string

Omit this parameter and the whole log message will be processed by this processor. No other value than @message is allowed for source.

ParseJSON

Description

This processor parses log events that are in JSON format. It can extract JSON key-value pairs and place them under a destination that you specify.

Additionally, because you must have at least one parse-type processor in a transformer, you can use ParseJSON as that processor for JSON-format logs, so that you can also apply other processors, such as mutate processors, to these logs.

For more information about this processor including examples, see parseJSON in the CloudWatch Logs User Guide.

Members
destination
Type: string

The location to put the parsed key value pair into. If you omit this parameter, it is placed under the root node.

source
Type: string

Path to the field in the log event that will be parsed. Use dot notation to access child fields. For example, store.book

ParseKeyValue

Description

This processor parses a specified field in the original log event into key-value pairs.

For more information about this processor including examples, see parseKeyValue in the CloudWatch Logs User Guide.

Members
destination
Type: string

The destination field to put the extracted key-value pairs into

fieldDelimiter
Type: string

The field delimiter string that is used between key-value pairs in the original log events. If you omit this, the ampersand & character is used.

keyPrefix
Type: string

If you want to add a prefix to all transformed keys, specify it here.

keyValueDelimiter
Type: string

The delimiter string to use between the key and value in each pair in the transformed log event.

If you omit this, the equal = character is used.

nonMatchValue
Type: string

A value to insert into the value field in the result, when a key-value pair is not successfully split.

overwriteIfExists
Type: boolean

Specifies whether to overwrite the value if the destination key already exists. If you omit this, the default is false.

source
Type: string

Path to the field in the log event that will be parsed. Use dot notation to access child fields. For example, store.book

ParsePostgres

Description

Use this processor to parse RDS for PostgreSQL vended logs, extract fields, and and convert them into a JSON format. This processor always processes the entire log event message. For more information about this processor including examples, see parsePostGres.

For more information about RDS for PostgreSQL log format, see RDS for PostgreSQL database log filesTCP flag sequence.

If you use this processor, it must be the first processor in your transformer.

Members
source
Type: string

Omit this parameter and the whole log message will be processed by this processor. No other value than @message is allowed for source.

ParseRoute53

Description

Use this processor to parse Route 53 vended logs, extract fields, and and convert them into a JSON format. This processor always processes the entire log event message. For more information about this processor including examples, see parseRoute53.

If you use this processor, it must be the first processor in your transformer.

Members
source
Type: string

Omit this parameter and the whole log message will be processed by this processor. No other value than @message is allowed for source.

ParseVPC

Description

Use this processor to parse Amazon VPC vended logs, extract fields, and and convert them into a JSON format. This processor always processes the entire log event message.

This processor doesn't support custom log formats, such as NAT gateway logs. For more information about custom log formats in Amazon VPC, see parseVPC For more information about this processor including examples, see parseVPC.

If you use this processor, it must be the first processor in your transformer.

Members
source
Type: string

Omit this parameter and the whole log message will be processed by this processor. No other value than @message is allowed for source.

ParseWAF

Description

Use this processor to parse WAF vended logs, extract fields, and and convert them into a JSON format. This processor always processes the entire log event message. For more information about this processor including examples, see parseWAF.

For more information about WAF log format, see Log examples for web ACL traffic.

If you use this processor, it must be the first processor in your transformer.

Members
source
Type: string

Omit this parameter and the whole log message will be processed by this processor. No other value than @message is allowed for source.

PatternToken

Description

A structure that contains information about one pattern token related to an anomaly.

For more information about patterns and tokens, see CreateLogAnomalyDetector.

Members
dynamicTokenPosition
Type: int

For a dynamic token, this indicates where in the pattern that this token appears, related to other dynamic tokens. The dynamic token that appears first has a value of 1, the one that appears second is 2, and so on.

enumerations
Type: Associative array of custom strings keys (TokenString) to long (int|float)s

Contains the values found for a dynamic token, and the number of times each value was found.

inferredTokenName
Type: string

A name that CloudWatch Logs assigned to this dynamic token to make the pattern more readable. The string part of the inferredTokenName gives you a clearer idea of the content of this token. The number part of the inferredTokenName shows where in the pattern this token appears, compared to other dynamic tokens. CloudWatch Logs assigns the string part of the name based on analyzing the content of the log events that contain it.

For example, an inferred token name of IPAddress-3 means that the token represents an IP address, and this token is the third dynamic token in the pattern.

isDynamic
Type: boolean

Specifies whether this is a dynamic token.

tokenString
Type: string

The string represented by this token. If this is a dynamic token, the value will be <*>

Policy

Description

A structure that contains information about one delivery destination policy.

Members
deliveryDestinationPolicy
Type: string

The contents of the delivery destination policy.

Processor

Description

This structure contains the information about one processor in a log transformer.

Members
addKeys
Type: AddKeys structure

Use this parameter to include the addKeys processor in your transformer.

copyValue
Type: CopyValue structure

Use this parameter to include the copyValue processor in your transformer.

csv
Type: CSV structure

Use this parameter to include the CSV processor in your transformer.

dateTimeConverter
Type: DateTimeConverter structure

Use this parameter to include the datetimeConverter processor in your transformer.

deleteKeys
Type: DeleteKeys structure

Use this parameter to include the deleteKeys processor in your transformer.

grok
Type: Grok structure

Use this parameter to include the grok processor in your transformer.

listToMap
Type: ListToMap structure

Use this parameter to include the listToMap processor in your transformer.

lowerCaseString
Type: LowerCaseString structure

Use this parameter to include the lowerCaseString processor in your transformer.

moveKeys
Type: MoveKeys structure

Use this parameter to include the moveKeys processor in your transformer.

parseCloudfront
Type: ParseCloudfront structure

Use this parameter to include the parseCloudfront processor in your transformer.

If you use this processor, it must be the first processor in your transformer.

parseJSON
Type: ParseJSON structure

Use this parameter to include the parseJSON processor in your transformer.

parseKeyValue
Type: ParseKeyValue structure

Use this parameter to include the parseKeyValue processor in your transformer.

parsePostgres
Type: ParsePostgres structure

Use this parameter to include the parsePostGres processor in your transformer.

If you use this processor, it must be the first processor in your transformer.

parseRoute53
Type: ParseRoute53 structure

Use this parameter to include the parseRoute53 processor in your transformer.

If you use this processor, it must be the first processor in your transformer.

parseVPC
Type: ParseVPC structure

Use this parameter to include the parseVPC processor in your transformer.

If you use this processor, it must be the first processor in your transformer.

parseWAF
Type: ParseWAF structure

Use this parameter to include the parseWAF processor in your transformer.

If you use this processor, it must be the first processor in your transformer.

renameKeys
Type: RenameKeys structure

Use this parameter to include the renameKeys processor in your transformer.

splitString
Type: SplitString structure

Use this parameter to include the splitString processor in your transformer.

substituteString
Type: SubstituteString structure

Use this parameter to include the substituteString processor in your transformer.

trimString
Type: TrimString structure

Use this parameter to include the trimString processor in your transformer.

typeConverter
Type: TypeConverter structure

Use this parameter to include the typeConverter processor in your transformer.

upperCaseString
Type: UpperCaseString structure

Use this parameter to include the upperCaseString processor in your transformer.

QueryCompileError

Description

Reserved.

Members
location
Type: QueryCompileErrorLocation structure

Reserved.

message
Type: string

Reserved.

QueryCompileErrorLocation

Description

Reserved.

Members
endCharOffset
Type: int

Reserved.

startCharOffset
Type: int

Reserved.

QueryDefinition

Description

This structure contains details about a saved CloudWatch Logs Insights query definition.

Members
lastModified
Type: long (int|float)

The date that the query definition was most recently modified.

logGroupNames
Type: Array of strings

If this query definition contains a list of log groups that it is limited to, that list appears here.

name
Type: string

The name of the query definition.

queryDefinitionId
Type: string

The unique ID of the query definition.

queryLanguage
Type: string

The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

queryString
Type: string

The query string to use for this definition. For more information, see CloudWatch Logs Insights Query Syntax.

QueryInfo

Description

Information about one CloudWatch Logs Insights query that matches the request in a DescribeQueries operation.

Members
createTime
Type: long (int|float)

The date and time that this query was created.

logGroupName
Type: string

The name of the log group scanned by this query.

queryId
Type: string

The unique ID number of this query.

queryLanguage
Type: string

The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

queryString
Type: string

The query string used in this query.

status
Type: string

The status of this query. Possible values are Cancelled, Complete, Failed, Running, Scheduled, and Unknown.

QueryStatistics

Description

Contains the number of log events scanned by the query, the number of log events that matched the query criteria, and the total number of bytes in the log events that were scanned.

If the query involved log groups that have field index policies, the estimated number of skipped log events and the total bytes of those skipped log events are included. Using field indexes to skip log events in queries reduces scan volume and improves performance. For more information, see Create field indexes to improve query performance and reduce scan volume.

Members
bytesScanned
Type: double

The total number of bytes in the log events scanned during the query.

estimatedBytesSkipped
Type: double

An estimate of the number of bytes in the log events that were skipped when processing this query, because the query contained an indexed field. Skipping these entries lowers query costs and improves the query performance time. For more information about field indexes, see PutIndexPolicy.

estimatedRecordsSkipped
Type: double

An estimate of the number of log events that were skipped when processing this query, because the query contained an indexed field. Skipping these entries lowers query costs and improves the query performance time. For more information about field indexes, see PutIndexPolicy.

logGroupsScanned
Type: double

The number of log groups that were scanned by this query.

recordsMatched
Type: double

The number of log events that matched the query string.

recordsScanned
Type: double

The total number of log events scanned during the query.

RecordField

Description

A structure that represents a valid record field header and whether it is mandatory.

Members
mandatory
Type: boolean

If this is true, the record field must be present in the recordFields parameter provided to a CreateDelivery or UpdateDeliveryConfiguration operation.

name
Type: string

The name to use when specifying this record field in a CreateDelivery or UpdateDeliveryConfiguration operation.

RejectedEntityInfo

Description

If an entity is rejected when a PutLogEvents request was made, this includes details about the reason for the rejection.

Members
errorType
Required: Yes
Type: string

The type of error that caused the rejection of the entity when calling PutLogEvents.

RejectedLogEventsInfo

Description

Represents the rejected events.

Members
expiredLogEventEndIndex
Type: int

The expired log events.

tooNewLogEventStartIndex
Type: int

The index of the first log event that is too new. This field is inclusive.

tooOldLogEventEndIndex
Type: int

The index of the last log event that is too old. This field is exclusive.

RenameKeyEntry

Description

This object defines one key that will be renamed with the renameKey processor.

Members
key
Required: Yes
Type: string

The key to rename

overwriteIfExists
Type: boolean

Specifies whether to overwrite the existing value if the destination key already exists. The default is false

renameTo
Required: Yes
Type: string

The string to use for the new key name

RenameKeys

Description

Use this processor to rename keys in a log event.

For more information about this processor including examples, see renameKeys in the CloudWatch Logs User Guide.

Members
entries
Required: Yes
Type: Array of RenameKeyEntry structures

An array of RenameKeyEntry objects, where each object contains the information about a single key to rename.

ResourceAlreadyExistsException

Description

The specified resource already exists.

Members

ResourceConfig

Description

This structure contains configuration details about an integration between CloudWatch Logs and another entity.

Members
openSearchResourceConfig
Type: OpenSearchResourceConfig structure

This structure contains configuration details about an integration between CloudWatch Logs and OpenSearch Service.

ResourceNotFoundException

Description

The specified resource does not exist.

Members

ResourcePolicy

Description

A policy enabling one or more entities to put logs to a log group in this account.

Members
lastUpdatedTime
Type: long (int|float)

Timestamp showing when this policy was last updated, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

policyDocument
Type: string

The details of the policy.

policyName
Type: string

The name of the resource policy.

ResultField

Description

Contains one field from one log event returned by a CloudWatch Logs Insights query, along with the value of that field.

For more information about the fields that are generated by CloudWatch logs, see Supported Logs and Discovered Fields.

Members
field
Type: string

The log event field.

value
Type: string

The value of this field.

S3DeliveryConfiguration

Description

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

Members
enableHiveCompatiblePath
Type: boolean

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

suffixPath
Type: 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.

SearchedLogStream

Description

Represents the search status of a log stream.

Members
logStreamName
Type: string

The name of the log stream.

searchedCompletely
Type: boolean

Indicates whether all the events in this log stream were searched.

ServiceQuotaExceededException

Description

This request exceeds a service quota.

Members

ServiceUnavailableException

Description

The service cannot complete the request.

Members

SessionStreamingException

Description

his exception is returned if an unknown error occurs during a Live Tail session.

Members
message
Type: string

SessionTimeoutException

Description

This exception is returned in a Live Tail stream when the Live Tail session times out. Live Tail sessions time out after three hours.

Members
message
Type: string

SplitString

Description

Use this processor to split a field into an array of strings using a delimiting character.

For more information about this processor including examples, see splitString in the CloudWatch Logs User Guide.

Members
entries
Required: Yes
Type: Array of SplitStringEntry structures

An array of SplitStringEntry objects, where each object contains the information about one field to split.

SplitStringEntry

Description

This object defines one log field that will be split with the splitString processor.

Members
delimiter
Required: Yes
Type: string

The separator characters to split the string entry on.

source
Required: Yes
Type: string

The key of the field to split.

StartLiveTailResponseStream

Description

This object includes the stream returned by your StartLiveTail request.

Members
SessionStreamingException
Type: SessionStreamingException structure

This exception is returned if an unknown error occurs.

SessionTimeoutException
Type: SessionTimeoutException structure

This exception is returned in the stream when the Live Tail session times out. Live Tail sessions time out after three hours.

sessionStart
Type: LiveTailSessionStart structure

This object contains information about this Live Tail session, including the log groups included and the log stream filters, if any.

sessionUpdate
Type: LiveTailSessionUpdate structure

This object contains the log events and session metadata.

SubscriptionFilter

Description

Represents a subscription filter.

Members
applyOnTransformedLogs
Type: boolean

This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see PutTransformer.

If this value is true, the subscription filter is applied on the transformed version of the log events instead of the original ingested log events.

creationTime
Type: long (int|float)

The creation time of the subscription filter, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

destinationArn
Type: string

The Amazon Resource Name (ARN) of the destination.

distribution
Type: string

The method used to distribute log data to the destination, which can be either random or grouped by log stream.

filterName
Type: string

The name of the subscription filter.

filterPattern
Type: string

A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

logGroupName
Type: string

The name of the log group.

roleArn
Type: string

SubstituteString

Description

This processor matches a key’s value against a regular expression and replaces all matches with a replacement string.

For more information about this processor including examples, see substituteString in the CloudWatch Logs User Guide.

Members
entries
Required: Yes
Type: Array of SubstituteStringEntry structures

An array of objects, where each object contains the information about one key to match and replace.

SubstituteStringEntry

Description

This object defines one log field key that will be replaced using the substituteString processor.

Members
from
Required: Yes
Type: string

The regular expression string to be replaced. Special regex characters such as [ and ] must be escaped using \\ when using double quotes and with \ when using single quotes. For more information, see Class Pattern on the Oracle web site.

source
Required: Yes
Type: string

The key to modify

to
Required: Yes
Type: string

The string to be substituted for each match of from

SuppressionPeriod

Description

If you are suppressing an anomaly temporariliy, this structure defines how long the suppression period is to be.

Members
suppressionUnit
Type: string

Specifies whether the value of value is in seconds, minutes, or hours.

value
Type: int

Specifies the number of seconds, minutes or hours to suppress this anomaly. There is no maximum.

ThrottlingException

Description

The request was throttled because of quota limits.

Members

TooManyTagsException

Description

A resource can have no more than 50 tags.

Members
message
Type: string
resourceName
Type: string

The name of the resource.

TransformedLogRecord

Description

This structure contains information for one log event that has been processed by a log transformer.

Members
eventMessage
Type: string

The original log event message before it was transformed.

eventNumber
Type: long (int|float)

The event number.

transformedEventMessage
Type: string

The log event message after being transformed.

TrimString

Description

Use this processor to remove leading and trailing whitespace.

For more information about this processor including examples, see trimString in the CloudWatch Logs User Guide.

Members
withKeys
Required: Yes
Type: Array of strings

The array containing the keys of the fields to trim.

TypeConverter

Description

Use this processor to convert a value type associated with the specified key to the specified type. It's a casting processor that changes the types of the specified fields. Values can be converted into one of the following datatypes: integer, double, string and boolean.

For more information about this processor including examples, see trimString in the CloudWatch Logs User Guide.

Members
entries
Required: Yes
Type: Array of TypeConverterEntry structures

An array of TypeConverterEntry objects, where each object contains the information about one field to change the type of.

TypeConverterEntry

Description

This object defines one value type that will be converted using the typeConverter processor.

Members
key
Required: Yes
Type: string

The key with the value that is to be converted to a different type.

type
Required: Yes
Type: string

The type to convert the field value to. Valid values are integer, double, string and boolean.

UnrecognizedClientException

Description

The most likely cause is an Amazon Web Services access key ID or secret key that's not valid.

Members

UpperCaseString

Description

This processor converts a string field to uppercase.

For more information about this processor including examples, see upperCaseString in the CloudWatch Logs User Guide.

Members
withKeys
Required: Yes
Type: Array of strings

The array of containing the keys of the field to convert to uppercase.

ValidationException

Description

One of the parameters for the request is not valid.

Members