QueryDefinitionProps

class aws_cdk.aws_logs.QueryDefinitionProps(*, query_definition_name, query_string, log_groups=None)

Bases: object

Properties for a QueryDefinition.

Parameters:
  • query_definition_name (str) – Name of the query definition.

  • query_string (QueryString) – The query string to use for this query definition.

  • log_groups (Optional[Sequence[ILogGroup]]) – Specify certain log groups for the query definition. Default: - no specified log groups

ExampleMetadata:

infused

Example:

logs.QueryDefinition(self, "QueryDefinition",
    query_definition_name="MyQuery",
    query_string=logs.QueryString(
        fields=["@timestamp", "@message"],
        parse_statements=["@message "[*] *" as loggingType, loggingMessage", "@message "<*>: *" as differentLoggingType, differentLoggingMessage"
        ],
        filter_statements=["loggingType = "ERROR"", "loggingMessage = "A very strange error occurred!""
        ],
        sort="@timestamp desc",
        limit=20
    )
)

Attributes

log_groups

Specify certain log groups for the query definition.

Default:
  • no specified log groups

query_definition_name

Name of the query definition.

query_string

The query string to use for this query definition.