Skip to content
v2.278.0

CfnQueryDefinitionProps Struct ​

Properties for defining a CfnQueryDefinition.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_logs as logs } from 'aws-cdk-lib';
const cfnQueryDefinitionProps: logs.CfnQueryDefinitionProps = {
  name: 'name',
  queryString: 'queryString',

  // the properties below are optional
  logGroupNames: ['logGroupNames'],
  parameters: [{
    name: 'name',

    // the properties below are optional
    defaultValue: 'defaultValue',
    description: 'description',
  }],
  queryLanguage: 'queryLanguage',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_logs as logs

cfn_query_definition_props = logs.CfnQueryDefinitionProps(
    name="name",
    query_string="queryString",

    # the properties below are optional
    log_group_names=["logGroupNames"],
    parameters=[logs.CfnQueryDefinition.QueryParameterProperty(
        name="name",

        # the properties below are optional
        default_value="defaultValue",
        description="description"
    )],
    query_language="queryLanguage"
)
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.logs.*;

CfnQueryDefinitionProps cfnQueryDefinitionProps = CfnQueryDefinitionProps.builder()
        .name("name")
        .queryString("queryString")

        // the properties below are optional
        .logGroupNames(List.of("logGroupNames"))
        .parameters(List.of(QueryParameterProperty.builder()
                .name("name")

                // the properties below are optional
                .defaultValue("defaultValue")
                .description("description")
                .build()))
        .queryLanguage("queryLanguage")
        .build();
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.Logs;

var cfnQueryDefinitionProps = new CfnQueryDefinitionProps {
    Name = "name",
    QueryString = "queryString",

    // the properties below are optional
    LogGroupNames = new [] { "logGroupNames" },
    Parameters = new [] { new QueryParameterProperty {
        Name = "name",

        // the properties below are optional
        DefaultValue = "defaultValue",
        Description = "description"
    } },
    QueryLanguage = "queryLanguage"
};
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"

cfnQueryDefinitionProps := &CfnQueryDefinitionProps{
	Name: jsii.String("name"),
	QueryString: jsii.String("queryString"),

	// the properties below are optional
	LogGroupNames: []interface{}{
		jsii.String("logGroupNames"),
	},
	Parameters: []interface{}{
		&QueryParameterProperty{
			Name: jsii.String("name"),

			// the properties below are optional
			DefaultValue: jsii.String("defaultValue"),
			Description: jsii.String("description"),
		},
	},
	QueryLanguage: jsii.String("queryLanguage"),
}

Properties ​

logGroupNamesoptionalstring | ILogGroupRef[]log_group_namesoptionaltyping.List[typing.Union[str, ILogGroupRef]]logGroupNamesoptionalList<String>LogGroupNamesoptionalstring[]LogGroupNamesoptional*[]interface{} #
Use this parameter if you want the query to query only certain log groups.
namestringnamestrnameStringNamestringName*string required #
A name for the query definition.

You can use the name to create a folder structure for your queries. To create a folder, use a forward slash (/) to prefix your desired query name with your desired folder name. For example, *folder-name* / *query-name* .

parametersoptionalIResolvable | IResolvable | CfnQueryDefinition.QueryParameterProperty[]parametersoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, QueryParameterProperty]]]parametersoptionalIResolvableParametersoptionalIResolvableParametersoptionalinterface{} #
Use this parameter to include specific query parameters as part of your query definition.
notes

Query parameters are supported only for Logs Insights QL queries. Query parameters allow you to use placeholder variables in your query string that are substituted with values at execution time. Use the {{parameterName}} syntax in your query string to reference a parameter.

queryLanguageoptionalstringquery_languageoptionalstrqueryLanguageoptionalStringQueryLanguageoptionalstringQueryLanguageoptional*string = "CWLI" #
The query language used for this query.

For more information about the query languages that CloudWatch Logs supports, see Supported query languages .

queryStringstringquery_stringstrqueryStringStringQueryStringstringQueryString*string required #
The query string to use for this query definition.

For more information, see CloudWatch Logs Insights Query Syntax .