LogQueryWidget Class
Display query results from Logs Insights.
Example
ts
declare const dashboard: cloudwatch.Dashboard;
dashboard.addWidgets(new cloudwatch.LogQueryWidget({
logGroupNames: ['my-log-group'],
view: cloudwatch.LogQueryVisualizationType.TABLE,
// The lines will be automatically combined using '\n|'.
queryLines: [
'fields @message',
'filter @message like /Error/',
]
}));
python
# dashboard: cloudwatch.Dashboard
dashboard.add_widgets(cloudwatch.LogQueryWidget(
log_group_names=["my-log-group"],
view=cloudwatch.LogQueryVisualizationType.TABLE,
# The lines will be automatically combined using '\n|'.
query_lines=["fields @message", "filter @message like /Error/"
]
))
java
Dashboard dashboard;
dashboard.addWidgets(LogQueryWidget.Builder.create()
.logGroupNames(List.of("my-log-group"))
.view(LogQueryVisualizationType.TABLE)
// The lines will be automatically combined using '\n|'.
.queryLines(List.of("fields @message", "filter @message like /Error/"))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Dashboard dashboard;
dashboard.AddWidgets(new LogQueryWidget(new LogQueryWidgetProps {
LogGroupNames = new [] { "my-log-group" },
View = LogQueryVisualizationType.TABLE,
// The lines will be automatically combined using '\n|'.
QueryLines = new [] { "fields @message", "filter @message like /Error/" }
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var dashboard Dashboard
dashboard.AddWidgets(cloudwatch.NewLogQueryWidget(&LogQueryWidgetProps{
LogGroupNames: []*string{
jsii.String("my-log-group"),
},
View: cloudwatch.LogQueryVisualizationType_TABLE,
// The lines will be automatically combined using '\n|'.
QueryLines: []*string{
jsii.String("fields @message"),
jsii.String("filter @message like /Error/"),
},
}))
Initializer
ts
new LogQueryWidget(props: LogQueryWidgetProps)
python
LogQueryWidget(props: LogQueryWidgetProps)
java
new LogQueryWidget(LogQueryWidgetProps props)
csharp
new LogQueryWidget(LogQueryWidgetProps props)
go
NewLogQueryWidget(Props LogQueryWidgetProps)
Properties
The amount of vertical grid units the widget will take up.
Any warnings that are produced as a result of putting together this widget.
warningsV2{ [key: string]: string }warnings_v2typing.Mapping[str, str]warningsV2Map<String, String>WarningsV2IDictionary<string, string>WarningsV2*map[string]*string#Any warnings that are produced as a result of putting together this widget.
The amount of horizontal grid units the widget will take up.
Methods
position(x: number, y: number): voiddef position(self, x: int | float, y: int | float) -> Nonepublic void position(Number x, Number y)public void Position(double x, double y)func Position(X *float64, Y *float64)#Place the widget at a given position.
toJson(): any[]def to_json(self, ) -> typing.List[Any]public List<Object> toJson()public object[] ToJson()func ToJson() *[]interface{}#Return the widget JSON for use in the dashboard.