Amazon CloudWatch Logs 2014-03-28
- 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.
- 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.
- DescribeAccountPolicies ( array $params = [] )
Returns a list of all CloudWatch Logs account policies in the account.
- 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.
- 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 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.
- 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.
- ListAnomalies ( array $params = [] )
Returns a list of anomalies that log anomaly detectors have found.
- ListLogAnomalyDetectors ( array $params = [] )
Retrieves a list of the log anomaly detectors in the account.
- 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 that applies to all 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.
- 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.
- StartQuery ( array $params = [] )
Schedules a query of a log group 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.
- 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.
- 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:
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 theresourceIdentifier
parameter that specifies aquery-result
resource. -
Specify the
resourceIdentifier
parameter with aquery-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 theresourceIdentifier
parameter or thelogGroup
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 theresourceIdentifier
parameter or thelogGroup
parameter, but you can't specify both.
Result Syntax
[]
Result Details
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The operation is not valid on the specified resource.
-
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 Kinesis Data Firehose.
To configure logs delivery between a supported Amazon Web Services service and a destination, you must do the following:
-
Create a delivery source, which is a logical object that represents the resource that is actually sending the logs. For more information, see PutDeliverySource.
-
Create a delivery destination, which is a logical object that represents the actual delivery destination. For more information, see PutDeliveryDestination.
-
If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy in the destination account to assign an IAM policy to the destination. This policy allows delivery to that destination.
-
Use
CreateDelivery
to create a delivery by pairing exactly one delivery source and one delivery destination.
You can configure a single delivery source to send logs to multiple destinations by creating multiple deliveries. You can also create multiple deliveries to configure multiple delivery sources to send logs to the same delivery destination.
You can't update an existing delivery. You can only create and delete deliveries.
Parameter Syntax
$result = $client->createDelivery([ 'deliveryDestinationArn' => '<string>', // REQUIRED 'deliverySourceName' => '<string>', // REQUIRED '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.
- 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>', 'id' => '<string>', 'tags' => ['<string>', ...], ], ]
Result Details
Members
- delivery
-
- Type: Delivery structure
A structure that contains information about the delivery that you just created.
Errors
-
The service cannot complete the request.
-
This operation attempted to create a resource that already exists.
-
The specified resource does not exist.
-
One of the parameters for the request is not valid.
-
You don't have sufficient permissions to perform this action.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
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
. - 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
-
A parameter is specified incorrectly.
-
You have reached the maximum number of resources that can be created.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The service cannot complete the request.
-
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 ARNs of the log groups that this anomaly detector will watch. You must specify at least one 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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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)
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.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
orlogs: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
Errors
-
A parameter is specified incorrectly.
-
ResourceAlreadyExistsException:
The specified resource already exists.
-
You have reached the maximum number of resources that can be created.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
Errors
-
A parameter is specified incorrectly.
-
ResourceAlreadyExistsException:
The specified resource already exists.
-
The specified resource does not exist.
-
The service cannot complete the request.
DeleteAccountPolicy
$result = $client->deleteAccountPolicy
([/* ... */]); $promise = $client->deleteAccountPolicyAsync
([/* ... */]);
Deletes a CloudWatch Logs account policy.
To use this operation, you must be signed on with the logs:DeleteDataProtectionPolicy
and logs:DeleteAccountPolicy
permissions.
Parameter Syntax
$result = $client->deleteAccountPolicy([ 'policyName' => '<string>', // REQUIRED 'policyType' => 'DATA_PROTECTION_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. Currently, the only valid value is
DATA_PROTECTION_POLICY
.
Result Syntax
[]
Result Details
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
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
Errors
-
A parameter is specified incorrectly.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The specified resource does not exist.
-
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
Errors
-
The specified resource does not exist.
-
The service cannot complete the request.
-
This operation attempted to create a resource that already exists.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
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
Errors
-
The specified resource does not exist.
-
The service cannot complete the request.
-
This operation attempted to create a resource that already exists.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
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
Errors
-
The service cannot complete the request.
-
One of the parameters for the request is not valid.
-
The specified resource does not exist.
-
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
Errors
-
The specified resource does not exist.
-
The service cannot complete the request.
-
This operation attempted to create a resource that already exists.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The service cannot complete the request.
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The service cannot complete the request.
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>', ...], 'policyName' => '<string>', 'policyType' => 'DATA_PROTECTION_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.
- 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. Currently, the only valid value is
DATA_PROTECTION_POLICY
.
Result Syntax
[ 'accountPolicies' => [ [ 'accountId' => '<string>', 'lastUpdatedTime' => <integer>, 'policyDocument' => '<string>', 'policyName' => '<string>', 'policyType' => 'DATA_PROTECTION_POLICY', 'scope' => 'ALL', ], // ... ], ]
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.
Errors
-
A parameter is specified incorrectly.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The specified resource does not exist.
-
The service cannot complete the request.
DescribeDeliveries
$result = $client->describeDeliveries
([/* ... */]); $promise = $client->describeDeliveriesAsync
([/* ... */]);
Retrieves a list of the deliveries that have been created in the account.
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>', 'id' => '<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
-
The service cannot complete the request.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
One of the parameters for the request is not valid.
-
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
-
The service cannot complete the request.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
One of the parameters for the request is not valid.
-
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
-
The service cannot complete the request.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
One of the parameters for the request is not valid.
-
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
-
A parameter is specified incorrectly.
-
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
-
A parameter is specified incorrectly.
-
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 toTrue
, 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 inaccountIdentifiers
.If this parameter is set to
true
andaccountIdentifiers
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 namedFooBar
,aws/Foo
, andGroupFoo
would match, butfoo
,F/o/o
andFroo
would not match.If you specify
logGroupNamePattern
in your request, then onlyarn
,creationTime
, andlogGroupName
are included in the response.logGroupNamePattern
andlogGroupNamePrefix
are mutually exclusive. Only one of these parameters can be passed. - logGroupNamePrefix
-
- Type: string
The prefix to match.
logGroupNamePrefix
andlogGroupNamePattern
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>', '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
-
A parameter is specified incorrectly.
-
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
orlogGroupName
, but not both. - logGroupName
-
- Type: string
The name of the log group.
You must include either
logGroupIdentifier
orlogGroupName
, but not both. - logStreamNamePrefix
-
- Type: string
The prefix to match.
If
orderBy
isLastEventTime
, 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 isLastEventTime
, the results are ordered by the event time. The default value isLogStreamName
.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 afterJan 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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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' => [ [ '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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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>', '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.
- status
-
- Type: string
Limits the returned queries to only those that have the specified status. Valid values are
Cancelled
,Complete
,Failed
,Running
, andScheduled
.
Result Syntax
[ 'nextToken' => '<string>', 'queries' => [ [ 'createTime' => <integer>, 'logGroupName' => '<string>', 'queryId' => '<string>', '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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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 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>', ]);
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.
Result Syntax
[ 'nextToken' => '<string>', 'queryDefinitions' => [ [ 'lastModified' => <integer>, 'logGroupNames' => ['<string>', ...], 'name' => '<string>', 'queryDefinitionId' => '<string>', '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
-
A parameter is specified incorrectly.
-
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
-
A parameter is specified incorrectly.
-
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' => [ [ '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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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 thequery-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 theresourceIdentifier
parameter or thelogGroup
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 theresourceIdentifier
parameter or thelogGroup
parameter, but you can't specify both.
Result Syntax
[]
Result Details
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
orlogGroupName
, but not both. - logGroupName
-
- Type: string
The name of the log group to search.
You must include either
logGroupIdentifier
orlogGroupName
, 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
andlogStreamNames
, but the value forlogStreamNamePrefix
does not match any log stream names specified inlogStreamNames
, the action returns anInvalidParameterException
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
logStreamNamePrefix
andlogStreamNames
, the action returns anInvalidParameterException
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 isfalse
.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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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
-
A parameter is specified incorrectly.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The specified resource does not exist.
-
The service cannot complete the request.
GetDelivery
$result = $client->getDelivery
([/* ... */]); $promise = $client->getDeliveryAsync
([/* ... */]);
Returns complete information about one delivery. A delivery is a connection between a logical delivery source and a logical delivery destination
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>', 'id' => '<string>', 'tags' => ['<string>', ...], ], ]
Result Details
Members
- delivery
-
- Type: Delivery structure
A structure that contains information about the delivery.
Errors
-
The specified resource does not exist.
-
The service cannot complete the request.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
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
-
The specified resource does not exist.
-
The service cannot complete the request.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
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
-
The service cannot complete the request.
-
One of the parameters for the request is not valid.
-
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
-
The specified resource does not exist.
-
The service cannot complete the request.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
The request was throttled because of quota limits.
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
toFIFTEEN_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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
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
orlogGroupName
, but not both. - logGroupName
-
- Type: string
The name of the log group.
You must include either
logGroupIdentifier
orlogGroupName
, 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 thenextToken
in this operation, you must specifytrue
forstartFromHead
. - 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 isfalse
.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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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
orlogGroupName
, but not both. - logGroupName
-
- Type: string
The name of the log group to search.
You must include either
logGroupIdentifier
orlogGroupName
, 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 omittime
, 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 sinceJanuary 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
-
A parameter is specified incorrectly.
-
You have reached the maximum number of resources that can be created.
-
The specified resource does not exist.
-
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 aslogRecordPointer
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 isfalse
.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
-
A parameter is specified incorrectly.
-
You have reached the maximum number of resources that can be created.
-
The specified resource does not exist.
-
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>', 'results' => [ [ [ 'field' => '<string>', 'value' => '<string>', ], // ... ], // ... ], 'statistics' => [ 'bytesScanned' => <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.
- 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 offield
/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
, andUnknown
.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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
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' => ['<string>', ...], 'patternId' => '<string>', 'patternRegex' => '<string>', 'patternString' => '<string>', 'patternTokens' => [ [ 'dynamicTokenPosition' => <integer>, 'enumerations' => [<integer>, ...], '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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
Multiple concurrent requests to update the same resource were in conflict.
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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
Multiple concurrent requests to update the same resource were in conflict.
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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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
-
The specified resource does not exist.
-
The service cannot complete the request.
PutAccountPolicy
$result = $client->putAccountPolicy
([/* ... */]); $promise = $client->putAccountPolicyAsync
([/* ... */]);
Creates an account-level data protection policy that applies to all log groups in the account. 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 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 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, 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 also 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.
Parameter Syntax
$result = $client->putAccountPolicy([ 'policyDocument' => '<string>', // REQUIRED 'policyName' => '<string>', // REQUIRED 'policyType' => 'DATA_PROTECTION_POLICY', // REQUIRED 'scope' => 'ALL', ]);
Parameter Details
Members
- 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 anOperation
property with anAudit
action. TheDataIdentifer
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 anAudit
action is required to find the sensitive data terms. ThisAudit
action must contain aFindingsDestination
object. You can optionally use thatFindingsDestination
object to list one or more destinations to send audit findings to. If you specify destinations such as log groups, Kinesis Data Firehose streams, and S3 buckets, they must already exist. -
The second block must include both a
DataIdentifer
array and anOperation
property with anDeidentify
action. TheDataIdentifer
array must exactly match theDataIdentifer
array in the first block of the policy.The
Operation
property with theDeidentify
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 includeName
,Description
, andVersion
fields. TheName
is different than the operation'spolicyName
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. - policyName
-
- Required: Yes
- Type: string
A name for the policy. This must be unique within the account.
- policyType
-
- Required: Yes
- Type: string
Currently the only valid value for this parameter is
DATA_PROTECTION_POLICY
. - 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 ofALL
is used.
Result Syntax
[ 'accountPolicy' => [ 'accountId' => '<string>', 'lastUpdatedTime' => <integer>, 'policyDocument' => '<string>', 'policyName' => '<string>', 'policyType' => 'DATA_PROTECTION_POLICY', 'scope' => 'ALL', ], ]
Result Details
Members
- accountPolicy
-
- Type: AccountPolicy structure
The account policy that you created.
Errors
-
A parameter is specified incorrectly.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The service cannot complete the request.
-
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 anOperation
property with anAudit
action. TheDataIdentifer
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 anAudit
action is required to find the sensitive data terms. ThisAudit
action must contain aFindingsDestination
object. You can optionally use thatFindingsDestination
object to list one or more destinations to send audit findings to. If you specify destinations such as log groups, Kinesis Data Firehose streams, and S3 buckets, they must already exist. -
The second block must include both a
DataIdentifer
array and anOperation
property with anDeidentify
action. TheDataIdentifer
array must exactly match theDataIdentifer
array in the first block of the policy.The
Operation
property with theDeidentify
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 includeName
,Description
, andVersion
fields. TheName
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
-
A parameter is specified incorrectly.
-
You have reached the maximum number of resources that can be created.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The specified resource does not exist.
-
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 Kinesis Data 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
-
The service cannot complete the request.
-
This operation attempted to create a resource that already exists.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
The request was throttled because of quota limits.
-
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
-
The service cannot complete the request.
-
One of the parameters for the request is not valid.
-
The specified resource does not exist.
-
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 Kinesis Data 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 valid values for this parameter, see the documentation for the source service.
- 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
-
The service cannot complete the request.
-
This operation attempted to create a resource that already exists.
-
One of the parameters for the request is not valid.
-
ServiceQuotaExceededException:
This request exceeds a service quota.
-
The specified resource does not exist.
-
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
-
A parameter is specified incorrectly.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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
forforceUpdate
, you are affirming that you have already updated the subscription filters. For more information, see Updating an existing cross-account subscriptionIf you omit this parameter, the default of
false
is used.
Result Syntax
[]
Result Details
Errors
-
A parameter is specified incorrectly.
-
Multiple concurrent requests to update the same resource were in conflict.
-
The service cannot complete the request.
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([ 'logEvents' => [ // REQUIRED [ 'message' => '<string>', // REQUIRED 'timestamp' => <integer>, // REQUIRED ], // ... ], 'logGroupName' => '<string>', // REQUIRED 'logStreamName' => '<string>', // REQUIRED 'sequenceToken' => '<string>', ]);
Parameter Details
Members
- 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 inPutLogEvents
actions.PutLogEvents
actions are now accepted and never returnInvalidSequenceTokenException
orDataAlreadyAcceptedException
even if the sequence token is not valid.
Result Syntax
[ 'nextSequenceToken' => '<string>', '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 parallelPutLogEvents
actions on the same log stream and you do not need to wait for the response of a previousPutLogEvents
action to obtain thenextSequenceToken
value. - rejectedLogEventsInfo
-
- Type: RejectedLogEventsInfo structure
The rejected events.
Errors
-
A parameter is specified incorrectly.
-
InvalidSequenceTokenException:
The sequence token is not valid. You can get the correct sequence token in the
expectedSequenceToken
field in theInvalidSequenceTokenException
message.PutLogEvents
actions are now always accepted and never returnInvalidSequenceTokenException
regardless of receiving an invalid sequence token. -
The event was already logged.
PutLogEvents
actions are now always accepted and never returnDataAlreadyAcceptedException
regardless of whether a given batch of log events has already been accepted. -
The specified resource does not exist.
-
The service cannot complete the request.
-
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.
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([ '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
- 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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
You have reached the maximum number of resources that can be created.
-
The service cannot complete the request.
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>', '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 you are updating a query definition 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.
- 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
-
A parameter is specified incorrectly.
-
You have reached the maximum number of resources that can be created.
-
The specified resource does not exist.
-
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 ofSourceAccount
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
-
A parameter is specified incorrectly.
-
You have reached the maximum number of resources that can be created.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
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 Kinesis Data 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
.
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([ 'destinationArn' => '<string>', // REQUIRED 'distribution' => 'Random|ByLogStream', 'filterName' => '<string>', // REQUIRED 'filterPattern' => '<string>', // REQUIRED 'logGroupName' => '<string>', // REQUIRED 'roleArn' => '<string>', ]);
Parameter Details
Members
- 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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
Multiple concurrent requests to update the same resource were in conflict.
-
You have reached the maximum number of resources that can be created.
-
The service cannot complete the request.
StartQuery
$result = $client->startQuery
([/* ... */]); $promise = $client->startQueryAsync
([/* ... */]);
Schedules a query of a log group using CloudWatch Logs Insights. You specify the log group 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.
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>', ...], '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 1000. - 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, the ARN can't end with an asterisk (*).
A
StartQuery
operation must include exactly one of the following parameters:logGroupName
,logGroupNames
, orlogGroupIdentifiers
. - 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
, orlogGroupIdentifiers
. - 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
, orlogGroupIdentifiers
. - 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
-
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.
-
A parameter is specified incorrectly.
-
You have reached the maximum number of resources that can be created.
-
The specified resource does not exist.
-
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
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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
Errors
-
The specified resource does not exist.
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
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
-
A parameter is specified incorrectly.
-
The service cannot complete the request.
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
Errors
-
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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
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>', '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.
- 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 asuppressionPeriod
. If you specifyINFINITE
, any value forsuppressionPeriod
is ignored.
Result Syntax
[]
Result Details
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
Multiple concurrent requests to update the same resource were in conflict.
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
toFIFTEEN_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
Errors
-
A parameter is specified incorrectly.
-
The specified resource does not exist.
-
The service cannot complete the request.
-
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.
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. Iffalse
, 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 strings
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
andERROR
and the amount of deviation from the baseline. Possible values areHIGH
,MEDIUM
, andLOW
. - 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 isSuppressed
. If this behavior is now considered to be normal, the value isBaseline
. - 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 theINFINITE
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.
ConflictException
Description
This operation attempted to create a resource that already exists.
Members
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
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.
You can't update an existing delivery. You can only create and delete deliveries.
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 Kinesis Data Firehose.
- deliverySourceName
-
- Type: string
The name of the delivery source that is associated with this delivery.
- id
-
- Type: string
The unique ID that identifies this delivery in your account.
- 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 Kinesis Data 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
-
- Type: DeliveryDestinationConfiguration structure
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 Kinesis Data 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 Kinesis Data 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 Kinesis Data 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).
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.
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
.
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
.
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
LogGroup
Description
Represents a log group.
Members
- arn
-
- Type: string
The Amazon Resource Name (ARN) of the log group.
- 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.
- 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
. ThelastEventTime
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
ThelastIngestionTime
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 obtainuploadSequenceToken
to use aPutLogEvents
action.
MalformedQueryException
Description
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.
Members
- queryCompileError
-
- Type: QueryCompileError structure
Reserved.
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
- 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
orrequestID
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
.
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
.
PatternToken
Description
A tructures 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 is2
, 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.
- 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.
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.
- 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.
- 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
, andUnknown
.
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.
Members
- bytesScanned
-
- Type: double
The total number of bytes in the log events scanned during the 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.
RejectedLogEventsInfo
Description
Represents the rejected events.
Members
- expiredLogEventEndIndex
-
- Type: int
The expired log events.
- tooNewLogEventStartIndex
-
- Type: int
The log events that are too new.
- tooOldLogEventEndIndex
-
- Type: int
The log events that are dated too far in the past.
ResourceAlreadyExistsException
Description
The specified resource already exists.
Members
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.
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
SubscriptionFilter
Description
Represents a subscription filter.
Members
- 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
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.
UnrecognizedClientException
Description
The most likely cause is an Amazon Web Services access key ID or secret key that's not valid.
Members
ValidationException
Description
One of the parameters for the request is not valid.