简体   繁体   中英

AWS Cloudwatch only shows “1” in log monitoring?

After more complex examples didn't work with the same outcome, I'm following the basic tutorial from here: https://docs.amazonaws.cn/en_us/AmazonCloudWatch/latest/logs/CountingLogEventsExample.html

I have set it up, and see the displayed dashboard: 在此处输入图片说明

I just send 1000 requests to the endpoint, however I'm only seeing "1" as the graphed metric.

ab -c 20 -n 1000 -T application/json -p data.json -m POST "<my-url.com>"

在此处输入图片说明

I'd like to see accurate reflection of request counts, what errors am I making in configuring cloudwatch metrics?

It sounds like you might be missing the log configuration from your ECS fargate task definition.

Make sure you have that setup. ie;

"logConfiguration": {
            "logDriver": "awslogs",
            "options": {
                "awslogs-group": "/ecs/my-app-logs",
                "awslogs-region": "us-east-1",
                "awslogs-stream-prefix": "myapp-prd-"
            }
        }

Take a read here, https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html#enable_awslogs

You must have the correct IAM permissions for logs:CreateLogStgream and logs:PutLogEvents attached to the IAM profile you use to run your ECS containers

The solution might have been to specify "0" as the default value (the default value is missing by default). I somehow go to see meaningful metrics, but when the metric value is "1", it shows I'm getting about 0.05 of them. Whatever the unit is (concurrency, maybe?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM