尽管角色和策略正确,但适用于EC2的CloudWatch Logs Unified Agent无法创建日志组

时间:2019-08-30 21:54:04

标签: apache amazon-web-services permissions amazon-cloudwatch

我遵循了此页面上有关查看[CloudWatch中的Apache日志](https://aws.amazon.com/blogs/mt/simplifying-apache-server-logs-with-amazon-cloudwatch-logs-insights/)的说明

Apache工作正常。 accesserror日志都在我在apache配置文件中指定的文件夹上生成。我已按照指定配置了代理文件,当我尝试重新启动代理时,该文件运行无任何错误。我什至将"namespace": "CWAgent"添加到配置中。

但是,我在CloudWatch中没有看到任何日志组。我对安装了日志代理的EC2实例所附加的角色授予了正确的策略权限。它似乎仍然没有解决。

"agent": {
                "metrics_collection_interval": 30,
                "run_as_user": "cwagent",
                "region": "us-east-1",
                "debug": true
        },
        "logs": {
                "logs_collected": {
                        "files": {
                                "collect_list": [
                                        {
                                                "file_path": "/var/log/www/error/*",
                                                "log_group_name": "httpd/error",
                                                "log_stream_name": "{instance_id}"
                                        },
                                        {
                                                "file_path": "/var/log/www/access/*",
                                                "log_group_name": "httpd/access",
                                                "log_stream_name": "{instance_id}"
                                        }
                                ]
                        }
                }
        },
        "metrics": {
                "namespace": "CWAgent",
                "append_dimensions": {
                        "AutoScalingGroupName": "${aws:AutoScalingGroupName}",
                        "ImageId": "${aws:ImageId}",
                        "InstanceId": "${aws:InstanceId}",
                        "InstanceType": "${aws:InstanceType}"
                },
                "metrics_collected": {
                        "cpu": {
                                "measurement": [
                                        "cpu_usage_idle",
                                        "cpu_usage_iowait",
                                        "cpu_usage_user",
                                        "cpu_usage_system"
                                ],
                                "metrics_collection_interval": 30,
                                "totalcpu": false
                        },
                        "disk": {
                                "measurement": [
                                        "used_percent",
                                        "inodes_free"
                                ],
                                "metrics_collection_interval": 30,
                                "resources": [
                                        "*"
                                ]
                        },
                        "diskio": {
                                                                                                                                                                                                                                        {
                        "AutoScalingGroupName": "${aws:AutoScalingGroupName}",
                        "ImageId": "${aws:ImageId}",
                        "InstanceId": "${aws:InstanceId}",
                        "InstanceType": "${aws:InstanceType}"
                },
                "metrics_collected": {
                        "cpu": {
                                "measurement": [
                                        "cpu_usage_idle",
                                        "cpu_usage_iowait",
                                        "cpu_usage_user",
                                        "cpu_usage_system"
                                ],
                                "metrics_collection_interval": 30,
                                "totalcpu": false
                        },
                        "disk": {
                                "measurement": [
                                        "used_percent",
                                        "inodes_free"
                                ],
                                "metrics_collection_interval": 30,
                                "resources": [
                                        "*"
                                ]
                        },
                        "diskio": {
                                "measurement": [
                                        "io_time"
                                ],
                                "metrics_collection_interval": 30,
                                "resources": [
                                        "*"
                                ]
                        },
                        "mem": {
                                "measurement": [
                                        "mem_used_percent" 
                                ],
                                "metrics_collection_interval": 30
                        },
                        "statsd": {
                                "metrics_aggregation_interval": 60,
                                "metrics_collection_interval": 60,
                                "service_address": ":8125"
                        },
                        "swap": {
                                "measurement": [
                                        "swap_used_percent"
                                ],
                                "metrics_collection_interval": 30
                        }
                }
        }
}

即使在代理日志文件中,我也看不到任何错误消息。它在那里发送完整尺寸。

0 个答案:

没有答案