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년 전2496회 조회
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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인