Actions, resources, and condition keys for Amazon CloudWatch Logs
Amazon CloudWatch Logs (service prefix: logs
) provides the following service-specific resources, actions, and condition context keys for use in IAM permission policies.
References:
-
Learn how to configure this service.
-
View a list of the API operations available for this service.
-
Learn how to secure this service and its resources by using IAM permission policies.
Topics
Actions defined by Amazon CloudWatch Logs
You can specify the following actions in the Action
element of an IAM policy statement. Use policies to grant permissions to perform an operation in AWS. When you use an action in a policy, you usually allow or deny access to the API operation or CLI command with the same name. However, in some cases, a single action controls access to more than one operation. Alternatively, some operations require several different actions.
The Resource types column indicates whether each action supports resource-level permissions. If there is no value for this column, you must specify all resources ("*") in the Resource
element of your policy statement. If the column includes a resource type, then you can specify an ARN of that type in a statement with that action. Required resources are indicated in the table with an asterisk (*). If you specify a resource-level permission ARN in a statement using this action, then it must be of this type. Some actions support multiple resource types. If the resource type is optional (not indicated as required), then you can choose to use one but not the other.
For details about the columns in the following table, see Actions table.
Actions | Description | Access level | Resource types (*required) | Condition keys | Dependent actions |
---|---|---|---|---|---|
AssociateKmsKey | Grants permissions to associate the specified AWS Key Management Service (AWS KMS) customer master key (CMK) with the specified log group | Write | |||
CancelExportTask | Grants permissions to cancel an export task if it is in PENDING or RUNNING state | Write | |||
CreateExportTask | Grants permissions to create an ExportTask which allows you to efficiently export data from a Log Group to your Amazon S3 bucket | Write | |||
CreateLogDelivery [permission only] | Grants permissions to create the log delivery | Write | |||
CreateLogGroup | Grants permissions to create a new log group with the specified name | Write | |||
CreateLogStream | Grants permissions to create a new log stream with the specified name | Write | |||
DeleteDestination | Grants permissions to delete the destination with the specified name | Write | |||
DeleteLogDelivery [permission only] | Grants permissions to delete the log delivery information for specified log delivery | Write | |||
DeleteLogGroup | Grants permissions to delete the log group with the specified name | Write | |||
DeleteLogStream | Grants permissions to delete a log stream | Write | |||
DeleteMetricFilter | Grants permissions to delete a metric filter associated with the specified log group | Write | |||
DeleteQueryDefinition | Grants permissions to delete a saved CloudWatch Logs Insights query definition | Write | |||
DeleteResourcePolicy | Grants permissions to delete a resource policy from this account | Permissions management | |||
DeleteRetentionPolicy | Grants permissions to delete the retention policy of the specified log group | Write | |||
DeleteSubscriptionFilter | Grants permissions to delete a subscription filter associated with the specified log group | Write | |||
DescribeDestinations | Grants permissions to return all the destinations that are associated with the AWS account making the request | List | |||
DescribeExportTasks | Grants permissions to return all the export tasks that are associated with the AWS account making the request | List | |||
DescribeLogGroups | Grants permissions to return all the log groups that are associated with the AWS account making the request | List | |||
DescribeLogStreams | Grants permissions to return all the log streams that are associated with the specified log group | List | |||
DescribeMetricFilters | Grants permissions to return all the metrics filters associated with the specified log group | List | |||
DescribeQueries | Grants permissions to return a list of CloudWatch Logs Insights queries that are scheduled, executing, or have been executed recently in this account | List | |||
DescribeQueryDefinitions | Grants permissions to return a paginated list of your saved CloudWatch Logs Insights query definitions | List | |||
DescribeResourcePolicies | Grants permissions to return all the resource policies in this account | List | |||
DescribeSubscriptionFilters | Grants permissions to return all the subscription filters associated with the specified log group | List | |||
DisassociateKmsKey | Grants permissions to disassociate the associated AWS Key Management Service (AWS KMS) customer master key (CMK) from the specified log group | Write | |||
FilterLogEvents | Grants permissions to retrieve log events, optionally filtered by a filter pattern from the specified log group | Read | |||
GetLogDelivery [permission only] | Grants permissions to get the log delivery information for specified log delivery | Read | |||
GetLogEvents | Grants permissions to retrieve log events from the specified log stream | Read | |||
GetLogGroupFields | Grants permissions to return a list of the fields that are included in log events in the specified log group, along with the percentage of log events that contain each field | Read | |||
GetLogRecord | Grants permissions to retrieve all the fields and values of a single log event | Read | |||
GetQueryResults | Grants permissions to return the results from the specified query | Read | |||
ListLogDeliveries [permission only] | Grants permissions to list all the log deliveries for specified account and/or log source | List | |||
ListTagsLogGroup | Grants permissions to list the tags for the specified log group | List | |||
PutDestination | Grants permissions to create or update a Destination | Write |
iam:PassRole |
||
PutDestinationPolicy | Grants permissions to create or update an access policy associated with an existing Destination | Write | |||
PutLogEvents | Grants permissions to upload a batch of log events to the specified log stream | Write | |||
PutMetricFilter | Grants permissions to create or update a metric filter and associates it with the specified log group | Write | |||
PutQueryDefinition | Grants permissions to create or update a query definition | Write | |||
PutResourcePolicy | Grants permissions to create or update a resource policy allowing other AWS services to put log events to this account | Permissions management | |||
PutRetentionPolicy | Grants permissions to set the retention of the specified log group | Write | |||
PutSubscriptionFilter | Grants permissions to create or update a subscription filter and associates it with the specified log group | Write |
iam:PassRole |
||
StartQuery | Grants permissions to schedules a query of a log group using CloudWatch Logs Insights | Read | |||
StopQuery | Grants permissions to stop a CloudWatch Logs Insights query that is in progress | Read | |||
TagLogGroup | Grants permissions to add or update the specified tags for the specified log group | Tagging | |||
TestMetricFilter | Grants permissions to test the filter pattern of a metric filter against a sample of log event messages | Read | |||
UntagLogGroup | Grants permissions to remove the specified tags from the specified log group | Tagging | |||
UpdateLogDelivery [permission only] | Grants permissions to update the log delivery information for specified log delivery | Write |
Resource types defined by Amazon CloudWatch Logs
The following resource types are defined by this service and can be used in the Resource
element of IAM permission policy statements. Each action in the Actions table identifies the resource types that can be specified with that action. A resource type can also define which condition keys you can include in a policy. These keys are displayed in the last column of the table. For details about the columns in the following table, see Resource types table.
Resource types | ARN | Condition keys |
---|---|---|
log-group |
arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}
|
|
log-stream |
arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}
|
|
destination |
arn:${Partition}:logs:${Region}:${Account}:destination:${DestinationName}
|
Condition keys for Amazon CloudWatch Logs
Amazon CloudWatch Logs defines the following condition keys that can be used in the Condition
element of an IAM policy. You can use these keys to further refine the conditions under which the policy statement applies. For details about the columns in the following table, see Condition keys table.
To view the global condition keys that are available to all services, see Available global condition keys.
Condition keys | Description | Type |
---|---|---|
aws:ResourceTag/${TagKey} | Filters access based on the tags associated with the resource | String |