CloudWatch search expression

0

Hi Everybody, I am doing CloudWatch search expression for graph metrics with a syntax:

SEARCH(' {AWS/EC2,InstanceId} MetricName="CPUUtilization" ', 'Average', 300)

But query will show all instances EC2. I want filter just instance name is: "ABC-asia-bastion-host". I did try with syntax bellow but maybe syntax false:

SEARCH(' {AWS/EC2,InstanceId,Instance name} MetricName="CPUUtilization" Instance name ="ABC-asia-bastion-host" ', 'Average', 300)

SEARCH(' {AWS/EC2,InstanceId} MetricName="CPUUtilization" Instance name="ABC-dev-asia-bastion-host" ', 'Average', 300)

Evidence in files attach: https://ibb.co/1GyCWCG

Please help me filter the exact instance name as expected.

Thank you so much.

Best regard.

質問済み 2年前2620ビュー
2回答
1

Hi there,

It seems you are trying to search the EC2 metric based on Instance Name tag which is unfortunately not supported by Search expression. The supported characteristics you can search based on are "metric names, namespaces, dimension names, and dimension values" as per 1.

On the contrary, you can use Metrics Explorer which supports Tag based searching - you can get more detail information from 2.

When you are on the Metrics Explorer section of the CloudWatch console select CPUUtilization metric from EC2 namespace, and on the following forms you can specify which Tag you want to filter the metric on and in this case you are using Name tag.

Metrics Explorer

For your reference, I have attached above image as a showcase. As shown on the image, you can filter by the "Name: ABC-asia-bastion-host" for the Tag instead of "Name: test-js-server" which I used for example.

I hope you find above information helpful.

Thanks,

Munkhbat

AWS
サポートエンジニア
回答済み 2年前
0

Hi Munkhbat,

By the way, If I use Metrics Explorer when attaching to my dashboard maybe not be good? It looks worse than I want. To use CloudWatch search expression for widgets, how to search to filter to InstancesID or InstanceName

Thank you so much. Best regard.

回答済み 2年前
  • Hi there,

    As mentioned previously, Search Expression only supports searching Namespace, Metric Name, Dimension Names and Values. Unfortunately, InstanceName is not a actual dimension from EC2 service which is shown on console(cosmetic feature that shows the Instance Name tag on the EC2 metrics for convenience). You can use the example shown here https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/search-expression-examples.html for your guidance.

    More importantly, please help the community by accepting answers if it resolved your issues.

    Thanks, Munkhbat

  • Hi Munkhbat_T,

    Thank you so much.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン