2025/05/21 - Amazon CloudWatch - 2 updated api methods
Changes Adds support for setting up Contributor Insight rules on logs transformed via Logs Transformation feature.
{'InsightRules': {'ApplyOnTransformedLogs': 'boolean'}}
Returns a list of all the Contributor Insights rules in your account.
For more information about Contributor Insights, see Using Contributor Insights to Analyze High-Cardinality Data.
See also: AWS API Documentation
Request Syntax
client.describe_insight_rules( NextToken='string', MaxResults=123 )
string
Include this value, if it was returned by the previous operation, to get the next set of rules.
integer
The maximum number of results to return in one operation. If you omit this parameter, the default of 500 is used.
dict
Response Syntax
{ 'NextToken': 'string', 'InsightRules': [ { 'Name': 'string', 'State': 'string', 'Schema': 'string', 'Definition': 'string', 'ManagedRule': True|False, 'ApplyOnTransformedLogs': True|False }, ] }
Response Structure
(dict) --
NextToken (string) --
If this parameter is present, it is a token that marks the start of the next batch of returned results.
InsightRules (list) --
The rules returned by the operation.
(dict) --
This structure contains the definition for a Contributor Insights rule. For more information about this rule, see Using Constributor Insights to analyze high-cardinality data in the Amazon CloudWatch User Guide.
Name (string) --
The name of the rule.
State (string) --
Indicates whether the rule is enabled or disabled.
Schema (string) --
For rules that you create, this is always {"Name": "CloudWatchLogRule", "Version": 1}. For managed rules, this is {"Name": "ServiceLogRule", "Version": 1}
Definition (string) --
The definition of the rule, as a JSON object. The definition contains the keywords used to define contributors, the value to aggregate on if this rule returns a sum instead of a count, and the filters. For details on the valid syntax, see Contributor Insights Rule Syntax.
ManagedRule (boolean) --
An optional built-in rule that Amazon Web Services manages.
ApplyOnTransformedLogs (boolean) --
Displays whether the rule is evaluated on the transformed versions of logs, for log groups that have Log transformation enabled. If this is false, log events are evaluated before they are transformed.
{'ApplyOnTransformedLogs': 'boolean'}
Creates a Contributor Insights rule. Rules evaluate log events in a CloudWatch Logs log group, enabling you to find contributor data for the log events in that log group. For more information, see Using Contributor Insights to Analyze High-Cardinality Data.
If you create a rule, delete it, and then re-create it with the same name, historical data from the first time the rule was created might not be available.
See also: AWS API Documentation
Request Syntax
client.put_insight_rule( RuleName='string', RuleState='string', RuleDefinition='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ], ApplyOnTransformedLogs=True|False )
string
[REQUIRED]
A unique name for the rule.
string
The state of the rule. Valid values are ENABLED and DISABLED.
string
[REQUIRED]
The definition of the rule, as a JSON object. For details on the valid syntax, see Contributor Insights Rule Syntax.
list
A list of key-value pairs to associate with the Contributor Insights rule. You can associate as many as 50 tags with a rule.
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 the resources that have certain tag values.
To be able to associate tags with a rule, you must have the cloudwatch:TagResource permission in addition to the cloudwatch:PutInsightRule permission.
If you are using this operation to update an existing Contributor Insights rule, any tags you specify in this parameter are ignored. To change the tags of an existing rule, use TagResource.
(dict) --
A key-value pair associated with a CloudWatch resource.
Key (string) -- [REQUIRED]
A string that you can use to assign a value. The combination of tag keys and values can help you organize and categorize your resources.
Value (string) -- [REQUIRED]
The value for the specified tag key.
boolean
Specify true to have this rule evalute log events after they have been transformed by Log transformation. If you specify true, then the log events in log groups that have transformers will be evaluated by Contributor Insights after being transformed. Log groups that don't have transformers will still have their original log events evaluated by Contributor Insights.
The default is false
dict
Response Syntax
{}
Response Structure
(dict) --