LogQueryWidget

class aws_cdk.aws_cloudwatch.LogQueryWidget(*, log_group_names, height=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.

  • height (Union[int, float, None]) – Height of the widget. Default: 6

  • query_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 of queryString, 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 of queryString, queryLines is required.

  • region (Optional[str]) – The region the metrics of this widget should be taken from. Default: Current region

  • title (Optional[str]) – Title for the widget. Default: No title

  • view (Optional[LogQueryVisualizationType]) – The type of view to use. Default: LogQueryVisualizationType.TABLE

  • width (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.

width

The amount of horizontal grid units the widget will take up.