windows - 在 Windows 2016上,AmazonEC2无法使用 ec2 cloudwatch日志

  显示原文与译文双语对照的内容
54 4

I Program 。ec2.windows 。cloudwatch 。json文件添加了一个 filesamazonssmpluginsawscloudwatchaws 。ec2文件,并重新启动了ssm服务,如 Windows 2016文档中所述。ssm代理日志中没有错误。但是,我没有看到 AWS.Cloudwatch.exe 正在运行,并且没有日志使它成为 cloudwatch 。

我只对应用程序和系统事件日志和 programdataamazonecslog 目录感兴趣。如果我这么做了我也会增加启动日志。

我在哪里可以找到线索?我尝试手动启动 AWS.Cloudwatch.exe,但不知道配置参数应该看起来像什么。

这是我的配置

$ssmconfig = @"
{
"IsEnabled": true,
"EngineConfiguration": {
"PollInterval":"00:00:05",
"Components": [
 {
"Id":"ApplicationEventLog",
"FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"LogName":"Application",
"Levels":"1"
 }
 },
 {
"Id":"SystemEventLog",
"FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"LogName":"System",
"Levels":"7"
 }
 },
 {
"Id":"SecurityEventLog",
"FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"LogName":"Security",
"Levels":"7"
 }
 },
 {
"Id":"CustomLogs",
"FullName":"AWS.EC2.Windows.CloudWatch.CustomLog.CustomLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"LogDirectoryPath":"C:\ProgramData\AmazonECSLog
",
"TimestampFormat":"MM/dd/yyyy HH:mm:ss",
"Encoding":"UTF-8",
"Filter":"",
"CultureName":"en-US",
"TimeZoneKind":"Local"
 }
 },
 {
"Id":"CloudWatchLogs",
"FullName":"AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"Region":"MYREGION}",
"LogGroup":"MYLOGGGROUP/win-host-eventlog",
"LogStream":"THISINSTANCEID"
 }
 },
 {
"Id":"CloudWatchEcsLogs",
"FullName":"AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"Region":"MYREGION",
"LogGroup":"MYLOGGROUP/win-host-ecs-logs",
"LogStream":"THISINSTANCEID"
 }
 }
 ],
"Flows": {
"Flows": [
"(ApplicationEventLog,SystemEventLog),CloudWatchLogs"
"CustomLogs,CloudWatchEcsLogs"
 ]
 }
 }
}
"@
Add-Content"C:Program FilesAmazonSSMPluginsawsCloudWatchAWS.ECS.Windows.CloudWatch.json" $ssmconfig
Restart-Service AmazonSSMAgent

`

时间:原作者:0个回答

123 5

根据文档:EC2Config服务不包含在 AWS Windows 2016中,你需要手动安装它。安装它,运行它,启用日志集成,并更新位于以下路径中的JSON文件( 正常):

C:Program FilesAmazonSSMPluginsawsCloudWatch

这是我在服务器上的配置。它工作正常,我同时得到日志和性能指标。

{
"IsEnabled": true,
"EngineConfiguration": {
"Components": [{
"FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"ApplicationEventLog",
"Parameters": {
"Levels":"1",
"LogName":"Application" 
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"SystemEventLog",
"Parameters": {
"Levels":"7",
"LogName":"System"
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"SecurityEventLog",
"Parameters": {
"Levels":"7",
"LogName":"Security"
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"ETW",
"Parameters": {
"Levels":"7",
"LogName":"Microsoft-Windows-WinINet/Analytic"
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.IisLog.IisLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"IISLog",
"Parameters": {
"LogDirectoryPath":"C:inetpublogsLogFilesW3SVC1"
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.CustomLog.CustomLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"CustomLogs",
"Parameters": {
"CultureName":"en-US",
"Encoding":"UTF-8",
"Filter":"",
"LogDirectoryPath":"C:Logs",
"TimeZoneKind":"Local",
"TimestampFormat":"yyyy-MM-dd HH:mm:ss"
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"PerformanceCounterMemory",
"Parameters": {
"CategoryName":"Memory",
"CounterName":"Available MBytes",
"DimensionName":"InstanceId",
"DimensionValue":"{instance_id}",
"InstanceName":"",
"MetricName":"Memory",
"Unit":"Megabytes"
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"PerformanceCounterDisk",
"Parameters": {
"CategoryName":"LogicalDisk",
"CounterName":"Free Megabytes",
"DimensionName":"InstanceId",
"DimensionValue":"{instance_id}",
"InstanceName":"D:",
"MetricName":"FreeDisk",
"Unit":"Megabytes"
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch",
"Id":"CloudWatchLogs",
"Parameters": {
"AccessKey":"",
"LogGroup":"ASG",
"LogStream":"{instance_id}",
"Region":"eu-west-1",
"SecretKey":""
 }
 }, {
"FullName":"AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch",
"Id":"CloudWatch",
"Parameters": {
"AccessKey":"",
"NameSpace":"PerformanceMonitor",
"Region":"eu-west-1",
"SecretKey":""
 }
 }],
"Flows": {
"Flows": [
"(PerformanceCounterMemory,PerformanceCounterDisk),CloudWatch",
"(ApplicationEventLog,SystemEventLog),CloudWatchLogs"
 ]
 },
"PollInterval":"00:00:15"
 }
}
原作者:
...