Create a CloudWatch graph with a search expression
On the CloudWatch console, you can access search capability when you add a graph to a dashboard, or by using the Metrics view.
You can't create an alarm based on a SEARCH expression. This is because search expressions return multiple time series, and an alarm based on a math expression can watch only one time series.
To add a graph with a search expression to an existing dashboard
-
Open the CloudWatch console at https://eusc-de-east-1.console.amazonaws-eusc.eu/cloudwatch/
. -
In the navigation pane, choose Dashboards and select a dashboard.
-
Choose Add widget.
-
Choose either Line or Stacked area and choose Configure.
-
On the Graphed metrics tab, choose Add a math expression.
-
For Details, enter the search expression that you want. For example,
SEARCH('{AWS/EC2,InstanceId} MetricName="CPUUtilization"', 'Average') -
(Optional) To add another search expression or math expression to the graph, choose Add a math expression
-
(Optional) After you add a search expression, you can specify a dynamic label to appear on the graph legend for each metric. Dynamic labels display a statistic about the metric and automatically update when the dashboard or graph is refreshed. To add a dynamic label, choose Graphed metrics and then Dynamic labels.
By default, the dynamic values you add to the label appear at the beginning of the label. You can then click the Label value for the metric to edit the label. For more information, see Use dynamic labels.
-
(Optional) To add a single metric to the graph, choose the All metrics tab and drill down to the metric you want.
-
(Optional) To change the time range shown on the graph, choose either custom at the top of the graph or one of the time periods to the left of custom.
-
Choose Create widget.
-
Choose Save dashboard.
To use the Metrics view to graph searched metrics
-
Open the CloudWatch console at https://eusc-de-east-1.console.amazonaws-eusc.eu/cloudwatch/
. -
In the navigation pane, choose Metrics, All metrics.
-
In the search field, enter the tokens to search for: for example,
cpuutilization t2.small.Results that match your search appear.
-
To graph all of the metrics that match your search, choose Graph search.
or
To refine your search, choose one of the namespaces that appeared in your search results.
-
If you selected a namespace to narrow your results, you can do the following:
-
To graph one or more metrics, select the check box next to each metric. To select all metrics, select the check box in the heading row of the table.
-
To refine your search, hover over a metric name and choose Add to search or Search for this only.
-
To view help for a metric, select the metric name and choose What is this?.
The selected metrics appear on the graph.
-
-
(Optional) Select one of the buttons in the search bar to edit that part of the search term.
-
(Optional) To add the graph to a dashboard, choose Actions and then Add to dashboard.