DeleteAccountPolicy
Deletes a CloudWatch Logs account policy. This stops the account-wide policy from applying to log groups or data sources in the account. If you delete a data protection policy or subscription filter policy, any log-group level policies of those types remain in effect. This operation supports deletion of data source-based field index policies, including facet configurations, in addition to log group-based policies.
To use this operation, you must be signed on with the correct permissions depending on the type of policy that you are deleting.
-
To delete a data protection policy, you must have the
logs:DeleteDataProtectionPolicyandlogs:DeleteAccountPolicypermissions. -
To delete a subscription filter policy, you must have the
logs:DeleteSubscriptionFilterandlogs:DeleteAccountPolicypermissions. -
To delete a transformer policy, you must have the
logs:DeleteTransformerandlogs:DeleteAccountPolicypermissions. -
To delete a field index policy, you must have the
logs:DeleteIndexPolicyandlogs:DeleteAccountPolicypermissions.If you delete a field index policy that included facet configurations, those facets will no longer be available for interactive exploration in the CloudWatch Logs Insights console. However, facet data is retained for up to 30 days.
-
To delete a retention policy, you must have the
logs:DeleteRetentionPolicyandlogs:DeleteAccountPolicypermissions. To preview the impact of deleting a retention policy, specifytruefordryRun.
If you delete a field index policy, the indexing of the log events that happened before you deleted the policy will still be used for up to 30 days to improve CloudWatch Logs Insights queries.
Request Syntax
{
"dryRun": boolean,
"policyName": "string",
"policyType": "string"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- dryRun
-
Specifies whether to preview the impact of deleting the policy without deleting it. If you specify
true, CloudWatch Logs does not delete the policy and returns the estimated impact indryRunResult. The default isfalse.Specifying
dryRunis valid only when you specifyRETENTION_POLICYforpolicyType. Only one dry run can be in progress for an account at a time.Type: Boolean
Required: No
- policyName
-
The name of the policy to delete.
Type: String
Required: Yes
- policyType
-
The type of policy to delete.
Type: String
Valid Values:
DATA_PROTECTION_POLICY | SUBSCRIPTION_FILTER_POLICY | FIELD_INDEX_POLICY | TRANSFORMER_POLICY | METRIC_EXTRACTION_POLICY | RETENTION_POLICYRequired: Yes
Response Syntax
{
"dryRunResult": {
"decreasedRetentionLogGroupCount": number,
"failedAnalysisCount": number,
"increasedRetentionLogGroupCount": number,
"topLogGroupsImpacted": [
{
"currentRetention": "string",
"logGroupName": "string",
"proposedRetention": "string",
"storedBytes": number
}
],
"totalMatchedLogGroups": number,
"unchangedRetentionLogGroupCount": number
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- dryRunResult
-
The estimated impact of deleting the policy. This field is returned only when the request specifies
dryRunastrue.Type: DryRunResult object
Errors
For information about the errors that are common to all actions, see Common Error Types.
- InvalidParameterException
-
A parameter is specified incorrectly.
HTTP Status Code: 400
- OperationAbortedException
-
Multiple concurrent requests to update the same resource were in conflict.
HTTP Status Code: 400
- ResourceNotFoundException
-
The specified resource does not exist.
HTTP Status Code: 400
- ServiceUnavailableException
-
The service cannot complete the request.
HTTP Status Code: 500
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: