AWS cli medium security documentation change
Summary
Updated documentation for PutAccountPolicy with expanded field index policy details, added data source-specific default indexes, clarified selection criteria, and introduced FieldsV2 configuration
Security assessment
The change adds validation that policy names cannot start with 'aws/' to prevent potential confusion with AWS-managed policies. This helps mitigate risks of policy impersonation or accidental override of critical policies. The update also documents security-relevant default indexes for WAF access logs (action, httpRequest.country) and CloudTrail logs (eventSource, eventName), which helps users implement better security monitoring.
Diff
diff --git a/cli/latest/reference/logs/put-account-policy.md b/cli/latest/reference/logs/put-account-policy.md index cd360c20d..9ad2088b3 100644 --- a//cli/latest/reference/logs/put-account-policy.md +++ b//cli/latest/reference/logs/put-account-policy.md @@ -15 +15 @@ - * [AWS CLI 2.32.16 Command Reference](../../index.html) » + * [AWS CLI 2.32.17 Command Reference](../../index.html) » @@ -59 +59 @@ First time using the AWS CLI? See the [User Guide](https://docs.aws.amazon.com/c -Creates an account-level data protection policy, subscription filter policy, field index policy, transformer policy, or metric extraction policy that applies to all log groups or a subset of log groups in the account. +Creates an account-level data protection policy, subscription filter policy, field index policy, transformer policy, or metric extraction policy that applies to all log groups, a subset of log groups, or a data source name and type combination in the account. @@ -119 +119,17 @@ You can create transformers only for the log groups in the Standard log class. -You can have one account-level transformer policy that applies to all log groups in the account. Or you can create as many as 20 account-level transformer policies that are each scoped to a subset of log groups with the `selectionCriteria` parameter. If you have multiple account-level transformer policies with selection criteria, no two of them can use the same or overlapping log group name prefixes. For example, if you have one policy filtered to log groups that start with `my-log` , you can’t have another field index policy filtered to `my-logpprod` or `my-logging` . +You can have one account-level transformer policy that applies to all log groups in the account. Or you can create as many as 20 account-level transformer policies that are each scoped to a subset of log groups with the `selectionCriteria` parameter. If you have multiple account-level transformer policies with selection criteria, no two of them can use the same or overlapping log group name prefixes. For example, if you have one policy filtered to log groups that start with `my-log` , you can’t have another transformer policy filtered to `my-logpprod` or `my-logging` . + +You can also set up a transformer at the log-group level. For more information, see [PutTransformer](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutTransformer.html) . If there is both a log-group level transformer created with `PutTransformer` and an account-level transformer that could apply to the same log group, the log group uses only the log-group level transformer. It ignores the account-level transformer. + +> **Field index policy** + +You can use field index policies to create indexes on fields found in log events for a log group or data source name and type combination. Creating field indexes can help lower the scan volume for CloudWatch Logs Insights queries that reference those fields, because these queries attempt to skip the processing of log events that are known to not match the indexed field. Good fields to index are fields that you often need to query for and fields or values that match only a small fraction of the total log events. Common examples of indexes include request ID, session ID, user IDs, or instance IDs. For more information, see [Create field indexes to improve query performance and reduce costs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatchLogs-Field-Indexing.html) + +To find the fields that are in your log group events, use the [GetLogGroupFields](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogGroupFields.html) operation. To find the fields for a data source use the [GetLogFields](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogFields.html) operation. + +For example, suppose you have created a field index for `requestId` . Then, any CloudWatch Logs Insights query on that log group that includes `requestId = *value* `` or ``requestId in [*value* , *value* , ...]` will attempt to process only the log events where the indexed field matches the specified value. + +Matches of log events to the names of indexed fields are case-sensitive. For example, an indexed field of `RequestId` won’t match a log event containing `requestId` . + +You can have one account-level field index policy that applies to all log groups in the account. Or you can create as many as 20 account-level field index policies that are each scoped to a subset of log groups using `LogGroupNamePrefix` with the `selectionCriteria` parameter. You can have another 20 account-level field index policies using `DataSourceName` and `DataSourceType` for the `selectionCriteria` parameter. If you have multiple account-level index policies with `LogGroupNamePrefix` selection criteria, no two of them can use the same or overlapping log group name prefixes. For example, if you have one policy filtered to log groups that start with _my-log_ , you can’t have another field index policy filtered to _my-logpprod_ or _my-logging_ . Similarly, if you have multiple account-level index policies with `DataSourceName` and `DataSourceType` selection criteria, no two of them can use the same data source name and type combination. For example, if you have one policy filtered to the data source name `amazon_vpc` and data source type `flow` you cannot create another policy with this combination. + +If you create an account-level field index policy in a monitoring account in cross-account observability, the policy is applied only to the monitoring account and not to any source accounts. @@ -126,0 +143,3 @@ CloudWatch Logs provides default field indexes for all log groups in the Standar + * `@data_source_name` + * `@data_source_type` + * `@data_format` @@ -127,0 +147,2 @@ CloudWatch Logs provides default field indexes for all log groups in the Standar + * `severityText` + * `attributes.session.id` @@ -131 +152 @@ CloudWatch Logs provides default field indexes for all log groups in the Standar -Default field indexes are in addition to any custom field indexes you define within your policy. Default field indexes are not counted towards your field index quota. +CloudWatch Logs provides default field indexes for certain data source name and type combinations as well. Default field indexes are automatically available for the following data source name and type combinations as identified in the following list: @@ -133 +154 @@ Default field indexes are in addition to any custom field indexes you define wit -You can also set up a transformer at the log-group level. For more information, see [PutTransformer](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutTransformer.html) . If there is both a log-group level transformer created with `PutTransformer` and an account-level transformer that could apply to the same log group, the log group uses only the log-group level transformer. It ignores the account-level transformer. +> `amazon_vpc.flow` @@ -135 +156,5 @@ You can also set up a transformer at the log-group level. For more information, -> **Field index policy** + * `action` + * `logStatus` + * `region` + * `flowDirection` + * `type` @@ -137 +161,0 @@ You can also set up a transformer at the log-group level. For more information, -You can use field index policies to create indexes on fields found in log events in the log group. Creating field indexes can help lower the scan volume for CloudWatch Logs Insights queries that reference those fields, because these queries attempt to skip the processing of log events that are known to not match the indexed field. Good fields to index are fields that you often need to query for and fields or values that match only a small fraction of the total log events. Common examples of indexes include request ID, session ID, user IDs, or instance IDs. For more information, see [Create field indexes to improve query performance and reduce costs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatchLogs-Field-Indexing.html) @@ -139 +162,0 @@ You can use field index policies to create indexes on fields found in log events -To find the fields that are in your log group events, use the [GetLogGroupFields](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogGroupFields.html) operation. @@ -141 +164 @@ To find the fields that are in your log group events, use the [GetLogGroupFields -For example, suppose you have created a field index for `requestId` . Then, any CloudWatch Logs Insights query on that log group that includes `requestId = *value* `` or ``requestId in [*value* , *value* , ...]` will attempt to process only the log events where the indexed field matches the specified value. +> `amazon_route53.resolver_query` @@ -143 +166,2 @@ For example, suppose you have created a field index for `requestId` . Then, any -Matches of log events to the names of indexed fields are case-sensitive. For example, an indexed field of `RequestId` won’t match a log event containing `requestId` . + * `transport` + * `rcode` @@ -145 +168,0 @@ Matches of log events to the names of indexed fields are case-sensitive. For exa -You can have one account-level field index policy that applies to all log groups in the account. Or you can create as many as 40 account-level field index policies (20 for log group prefix selection, 20 for data source selection) that are each scoped to a subset of log groups or data sources with the `selectionCriteria` parameter. Field index policies can now be created for specific data source name and type combinations using DataSourceName and DataSourceType selection criteria. If you have multiple account-level index policies with selection criteria, no two of them can use the same or overlapping log group name prefixes. For example, if you have one policy filtered to log groups that start with `my-log` , you can’t have another field index policy filtered to `my-logpprod` or `my-logging` . @@ -147 +169,0 @@ You can have one account-level field index policy that applies to all log groups -If you create an account-level field index policy in a monitoring account in cross-account observability, the policy is applied only to the monitoring account and not to any source accounts. @@ -149 +171,25 @@ If you create an account-level field index policy in a monitoring account in cro -If you want to create a field index policy for a single log group, you can use [PutIndexPolicy](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutIndexPolicy.html) instead of `PutAccountPolicy` . If you do so, that log group will use only that log-group level policy, and will ignore the account-level policy that you create with [PutAccountPolicy](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutAccountPolicy.html) . +> `aws_waf.access` + + * `action` + * `httpRequest.country` + + + +> `aws_cloudtrail.data` , `aws_cloudtrail.management` + + * `eventSource` + * `eventName` + * `awsRegion` + * `userAgent` + * `errorCode` + * `eventType` + * `managementEvent` + * `readOnly` + * `eventCategory` + * `requestId` + + + +Default field indexes are in addition to any custom field indexes you define within your policy. Default field indexes are not counted towards your [field index quota](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatchLogs-Field-Indexing-Syntax) . + +If you want to create a field index policy for a single log group, you can use [PutIndexPolicy](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutIndexPolicy.html) instead of `PutAccountPolicy` . If you do so, that log group will use that log-group level policy and any account-level policies that match at the data source level; any account-level policy that matches at the log group level (for example, no selection criteria or log group name prefix selection criteria) will be ignored. @@ -217 +263 @@ See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/logs-2 -> A name for the policy. This must be unique within the account. +> A name for the policy. This must be unique within the account and cannot start with `aws/` . @@ -265,0 +312 @@ See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/logs-2 +> * **FieldsV2** The object of field indexes to create along with it’s type. @@ -271 +318 @@ See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/logs-2 -> The following is an example of an index policy document that creates two indexes, `RequestId` and `TransactionId` . +> The following is an example of an index policy document that creates indexes with different types. @@ -273 +320,3 @@ See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/logs-2 ->> `"policyDocument": "{ \"Fields\": [ \"RequestId\", \"TransactionId\" ] }"` +>> `"policyDocument": "{ \"Fields\": [ \"TransactionId\" ], \"FieldsV2\": {\"RequestId\": {\"type\": \"FIELD_INDEX\"}, \"APIName\": {\"type\": \"FACET\"}, \"StatusCode\": {\"type\": \"FACET\"}}}"` +> +> You can use `FieldsV2` to specify the type for each field. Supported types are `FIELD_INDEX` and `FACET` . Field names within `Fields` and `FieldsV2` must be mutually exclusive. @@ -301 +350 @@ See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/logs-2 -> Use this parameter to apply the new policy to a subset of log groups in the account. +> Use this parameter to apply the new policy to a subset of log groups in the account or a data source name and type combination. @@ -305 +354,7 @@ See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/logs-2 -> If `policyType` is `SUBSCRIPTION_FILTER_POLICY` , the only supported `selectionCriteria` filter is `LogGroupName NOT IN []` +> * If `policyType` is `SUBSCRIPTION_FILTER_POLICY` , the only supported `selectionCriteria` filter is `LogGroupName NOT IN []` +> * If `policyType` is `TRANSFORMER_POLICY` , the only supported `selectionCriteria` filter is `LogGroupNamePrefix` +> * If `policyType` is `FIELD_INDEX_POLICY` , the supported `selectionCriteria` filters are: +> * `LogGroupNamePrefix` +> * `DataSourceName` AND `DataSourceType` +> + @@ -307 +362 @@ See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/logs-2 -> If `policyType` is `FIELD_INDEX_POLICY` or `TRANSFORMER_POLICY` , the only supported `selectionCriteria` filter is `LogGroupNamePrefix` +> When you specify `selectionCriteria` for a field index policy you can use either `LogGroupNamePrefix` by itself or `DataSourceName` and `DataSourceType` together. @@ -486 +541 @@ accountPolicy -> (structure) - * [AWS CLI 2.32.16 Command Reference](../../index.html) » + * [AWS CLI 2.32.17 Command Reference](../../index.html) »