Resource: awsCloudwatchQueryDefinition
Provides a CloudWatch Logs query definition resource.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloudwatchQueryDefinition.CloudwatchQueryDefinition(this, "example", {
logGroupNames: ["/aws/logGroup1", "/aws/logGroup2"],
name: "custom_query",
queryString:
"fields @timestamp, @message\n| sort @timestamp desc\n| limit 25\n",
});
Argument Reference
The following arguments are supported:
name
- (Required) The name of the query.queryString
- (Required) The query to save. You can read more about CloudWatch Logs Query Syntax in the documentation.logGroupNames
- (Optional) Specific log groups to use with the query.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
queryDefinitionId
- The query definition ID.
Import
CloudWatch query definitions can be imported using the query definition ARN. The ARN can be found on the "Edit Query" page for the query in the AWS Console.