"amazon-cloudwatch-agent.json" configuration file parameter configuration error

1
/opt/aws/amazon-cloudwatch-agent/bin/config-translator --input /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json --input-dir /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d --output /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml --mode onPrem --config /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml --multi-config default
2023/11/03 03:32:11 Reading json config file path: /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/file_amazon-cloudwatch-agent.json.tmp ...
2023/11/03 03:32:11 Invalid Json input schema.
2023/11/03 03:32:11 Under path : /logs/logs_collected | Error : Additional property log_stream_name is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected | Error : Additional property force_flush_interval is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/0 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/0 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/0 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/1 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/1 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/1 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/2 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/2 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/2 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/3 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/3 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/3 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/4 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/4 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/4 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/5 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/5 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/5 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/6 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/6 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/6 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/7 | Error : Additional property initial_position is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/7 | Error : Additional property buffer_duration is not allowed
2023/11/03 03:32:11 Under path : /logs/logs_collected/files/collect_list/7 | Error : Additional property datetime_format is not allowed
2023/11/03 03:32:11 I! AmazonCloudWatchAgent Version 1.232905.0.
2023/11/03 03:32:11 Configuration validation first phase failed. Agent version: 1.232905.0. Verify the JSON input is only using features supported by this version.

This error indicates that the CloudWatch agent encountered a problem while trying to parse the configuration file. According to the error message, the logs section of the configuration file contains some extra properties that are not allowed, such as log_stream_name, force_flush_interval, datetime_format, initial_position, and buffer_duration1.

The "amazon-cloudwatch-agent.json" logs configuration section is

 "logs": {
    "logs_collected": {
      "files": {
        "collect_list": [
          {
            "file_path": "/home/watch/logs/antivirus/antivirus.log",
            "log_group_name": "antivirus",
            "log_stream_name": "Test_Server",
            "datetime_format": "%Y-%m-%d %H:%M:%S",
            "buffer_duration": 5000,
            "initial_position": "start_of_file"
          },
         
          {
            "file_path": "/home/watch/logs/sftp/sftp_monitor.log",
            "log_group_name": "Test_file_monitor",
            "log_stream_name": "Test",
            "datetime_format": "%Y-%m-%d %H:%M:%S",
            "buffer_duration": 5000,
            "initial_position": "start_of_file"
          },
          {
            "file_path": "/home/watch/logs/SSH_Attacks.log",
            "log_group_name": "ubuntu_ec2_auth",
            "log_stream_name": "SSH_Attacks",
            "datetime_format": "%Y-%m-%d %H:%M:%S",
            "buffer_duration": 5000,
            "initial_position": "start_of_file"
          }
        ]
      },
      "log_stream_name": "TestServer_log_stream_name",
      "force_flush_interval": 15
    }
  }

How to solve this problem and how to configure it?

DD-Boom
質問済み 7ヶ月前642ビュー
1回答
0

Hello.

If you look at the document below, there is no parameter called "datetime_format" and "initial_position" and "buffer_duration".
Also, do not include "log_stream_name" and "force_flush_interval" in "logs_collected".
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html#CloudWatch-Agent-Configuration-File-Logssection

So, I think the configuration file will be something like the following.

"logs": {
    "logs_collected": {
      "files": {
        "collect_list": [
          {
            "file_path": "/home/watch/logs/antivirus/antivirus.log",
            "log_group_name": "antivirus",
            "log_stream_name": "Test_Server",
            "timestamp_format": "%Y-%m-%d %H:%M:%S",
          },
          {
            "file_path": "/home/watch/logs/sftp/sftp_monitor.log",
            "log_group_name": "Test_file_monitor",
            "log_stream_name": "Test",
            "timestamp_format": "%Y-%m-%d %H:%M:%S",
          },
          {
            "file_path": "/home/watch/logs/SSH_Attacks.log",
            "log_group_name": "ubuntu_ec2_auth",
            "log_stream_name": "SSH_Attacks",
            "timestamp_format": "%Y-%m-%d %H:%M:%S",
          }
        ]
      },
    },
    "force_flush_interval": 15,
    "log_stream_name": "TestServer_log_stream_name"
  }
profile picture
エキスパート
回答済み 7ヶ月前
profile picture
エキスパート
レビュー済み 7ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ