# CfnInsightRuleProps

Properties for defining a `CfnInsightRule`.

Used as props by: [CfnInsightRule](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnInsightRule.html)

- Source: Generated at build time
- Type last changed: v2.262.0 · 22 Jul 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
const cfnInsightRuleProps: cloudwatch.CfnInsightRuleProps = {
  ruleBody: 'ruleBody',
  ruleName: 'ruleName',
  ruleState: 'ruleState',

  // the properties below are optional
  applyOnTransformedLogs: false,
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
```

Python:

```python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudwatch as cloudwatch

cfn_insight_rule_props = cloudwatch.CfnInsightRuleProps(
    rule_body="ruleBody",
    rule_name="ruleName",
    rule_state="ruleState",

    # the properties below are optional
    apply_on_transformed_logs=False,
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudwatch.*;

CfnInsightRuleProps cfnInsightRuleProps = CfnInsightRuleProps.builder()
        .ruleBody("ruleBody")
        .ruleName("ruleName")
        .ruleState("ruleState")

        // the properties below are optional
        .applyOnTransformedLogs(false)
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudWatch;

var cfnInsightRuleProps = new CfnInsightRuleProps {
    RuleBody = "ruleBody",
    RuleName = "ruleName",
    RuleState = "ruleState",

    // the properties below are optional
    ApplyOnTransformedLogs = false,
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnInsightRuleProps := &CfnInsightRuleProps{
	RuleBody: jsii.String("ruleBody"),
	RuleName: jsii.String("ruleName"),
	RuleState: jsii.String("ruleState"),

	// the properties below are optional
	ApplyOnTransformedLogs: jsii.Boolean(false),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}
```

## Properties

- `applyOnTransformedLogs`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) = false — Determines whether the rules is evaluated on transformed versions of logs.

  Valid values are `TRUE` and `FALSE` .

- `ruleBody`: string (required) — The definition of the rule, as a JSON object.

  For details about the syntax, see [Contributor Insights Rule Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights-RuleSyntax.html) in the *Amazon CloudWatch User Guide* .

- `ruleName`: string (required) — The name of the rule.

- `ruleState`: string (required) — The current state of the rule.

  Valid values are `ENABLED` and `DISABLED` .

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — 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. For more information, see [Tagging Your Amazon CloudWatch Resources](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Tagging.html) .

  To be able to associate tags with a rule, you must have the `cloudwatch:TagResource` permission in addition to the `cloudwatch:PutInsightRule` permission.
