获取错误消息
“插件[logsMetric]中出现错误:访问被拒绝。”
我正在使用EC2窗口。我已经安装了 cloudwatch 代理并创建了 config.json 。
我启动了代理。 Windows日志正在写入 cloudwatch ,但应用程序日志未写入。我正在
CLoudwatchagent日志中的[logsMetric]:访问被拒绝
我在
下有应用程序日志C:\ Apachelogs , C:\ MongoLogs
哪个应用日志没有被写入。 我还为实例附加了以下策略 CloudWatchAgentAdminPolicy 和 AmazonSSMManagedInstanceCore
config.json:
{
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "C:\\ApacheLogs",
"log_group_name": "ApacheLogs",
"log_stream_name": "{instance_id}"
},
{
"file_path": "C:\\Platformlog",
"log_group_name": "Platformlog",
"log_stream_name": "{instance_id}"
},
{
"file_path": "C:\\Enrichmentlog",
"log_group_name": "Enrichmentlog",
"log_stream_name": "{instance_id}"
},
{
"file_path": "C:\\Mongolog",
"log_group_name": "Mongolog",
"log_stream_name": "{instance_id}"
}
]
},
"windows_events": {
"collect_list": [
{
"event_format": "xml",
"event_levels": [
"VERBOSE",
"INFORMATION",
"WARNING",
"ERROR",
"CRITICAL"
],
"event_name": "System",
"log_group_name": "System",
"log_stream_name": "{instance_id}"
},
{
"event_format": "xml",
"event_levels": [
"VERBOSE",
"INFORMATION",
"WARNING",
"ERROR",
"CRITICAL"
],
"event_name": "System",
"log_group_name": "System",
"log_stream_name": "{instance_id}"
}
]
}
}
},
"metrics": {
"append_dimensions": {
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
"ImageId": "${aws:ImageId}",
"InstanceId": "${aws:InstanceId}",
"InstanceType": "${aws:InstanceType}"
},
"metrics_collected": {
"Memory": {
"measurement": [
"% Committed Bytes In Use"
],
"metrics_collection_interval": 60
},
"Paging File": {
"measurement": [
"% Usage"
],
"metrics_collection_interval": 60,
"resources": [
"*"
]
},
"statsd": {
"metrics_aggregation_interval": 60,
"metrics_collection_interval": 60,
"service_address": ":8125"
}
}
}
}
答案 0 :(得分:0)
这是我找到的解决方案,
我们需要指定我们需要从文件夹中收集的文件路径或文件模式。 前面我刚刚提到了文件夹的路径。
更早:
“ file_path”:“ C:\ ApacheLogs”,
工作解决方案:
“ file_path”:“ C:\ ApacheLogs \ *。logs”