LogQueryWidget
- class aws_cdk.aws_cloudwatch.LogQueryWidget(*, log_group_names, account_id=None, height=None, query_language=None, query_lines=None, query_string=None, region=None, title=None, view=None, width=None)
Bases:
ConcreteWidget
Display query results from Logs Insights.
- exampleMetadata:
infused
Example:
# 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 '
- |’.
query_lines=[“fields @message”, “filter @message like /Error/” ]
))
- Parameters:
log_group_names (
Sequence
[str
]) – Names of log groups to query.account_id (
Optional
[str
]) – The AWS account ID where the log groups are located. This enables cross-account functionality for CloudWatch dashboards. Before using this feature, ensure that proper cross-account sharing is configured between the monitoring account and source account. For more information, see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html Default: - Current accountheight (
Union
[int
,float
,None
]) – Height of the widget. Default: 6query_language (
Optional
[LogQueryLanguage
]) – The query language to use for the query. Default: LogQueryLanguage.LOGS_INSIGHTSquery_lines (
Optional
[Sequence
[str
]]) – A sequence of lines to use to build the query. The query will be built by joining the lines together using\n|
. Default: - Exactly one ofqueryString
,queryLines
is required.query_string (
Optional
[str
]) – Full query string for log insights. Be sure to prepend every new line with a newline and pipe character (\n|
). Default: - Exactly one ofqueryString
,queryLines
is required.region (
Optional
[str
]) – The region the metrics of this widget should be taken from. Default: Current regiontitle (
Optional
[str
]) – Title for the widget. Default: No titleview (
Optional
[LogQueryVisualizationType
]) – The type of view to use. Default: LogQueryVisualizationType.TABLEwidth (
Union
[int
,float
,None
]) – Width of the widget, in a grid of 24 units wide. Default: 6
Methods
- position(x, y)
Place the widget at a given position.
- Parameters:
x (
Union
[int
,float
])y (
Union
[int
,float
])
- Return type:
None
- to_json()
Return the widget JSON for use in the dashboard.
- Return type:
List
[Any
]
Attributes
- height
The amount of vertical grid units the widget will take up.
- warnings
Any warnings that are produced as a result of putting together this widget.
- warnings_v2
Any warnings that are produced as a result of putting together this widget.
- width
The amount of horizontal grid units the widget will take up.