interface QueryDefinitionProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Logs.QueryDefinitionProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslogs#QueryDefinitionProps |
Java | software.amazon.awscdk.services.logs.QueryDefinitionProps |
Python | aws_cdk.aws_logs.QueryDefinitionProps |
TypeScript (source) | aws-cdk-lib » aws_logs » QueryDefinitionProps |
Properties for a QueryDefinition.
Example
new logs.QueryDefinition(this, 'QueryDefinition', {
queryDefinitionName: 'MyQuery',
queryString: new logs.QueryString({
fields: ['@timestamp', '@message'],
parseStatements: [
'@message "[*] *" as loggingType, loggingMessage',
'@message "<*>: *" as differentLoggingType, differentLoggingMessage',
],
filterStatements: [
'loggingType = "ERROR"',
'loggingMessage = "A very strange error occurred!"',
],
statsStatements: [
'count(loggingMessage) as loggingErrors',
'count(differentLoggingMessage) as differentLoggingErrors',
],
sort: '@timestamp desc',
limit: 20,
}),
});
Properties
| Name | Type | Description |
|---|---|---|
| query | string | Name of the query definition. |
| query | Query | The query string to use for this query definition. |
| log | ILog[] | Specify certain log groups for the query definition. |
queryDefinitionName
Type:
string
Name of the query definition.
queryString
Type:
Query
The query string to use for this query definition.
logGroups?
Type:
ILog[]
(optional, default: no specified log groups)
Specify certain log groups for the query definition.

.NET
Go
Java
Python
TypeScript (