"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달 전643회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠