简体   繁体   English

AWS Cloudwatch在日志监控中仅显示“ 1”?

[英]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 在更复杂的示例无法达到相同的结果之后,我从此处开始关注基本教程: https : //docs.amazonaws.cn/zh_CN/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. 我只向端点发送了1000个请求,但是我只看到“ 1”作为图形化指标。

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? 我想准确反映请求计数,在配置cloudwatch指标时犯了什么错误?

It sounds like you might be missing the log configuration from your ECS fargate task definition. 听起来您可能缺少ECS Fargate任务定义中的日志配置。

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 在这里阅读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 您必须对用于运行ECS容器的IAM配置文件附带的logs:CreateLogStgream和logs:PutLogEvents具有正确的IAM权限

The solution might have been to specify "0" as the default value (the default value is missing by default). 解决方案可能是将“ 0”指定为默认值(默认情况下缺少默认值)。 I somehow go to see meaningful metrics, but when the metric value is "1", it shows I'm getting about 0.05 of them. 我以某种方式去查看有意义的指标,但是当指标值是“ 1”时,它表明我得到了其中的0.05。 Whatever the unit is (concurrency, maybe?) 单位是什么(并发,也许?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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