Example AWS Cloudwatch Agent Config

cat /opt/aws/amazon-cloudwatch-agent/bin/config.json
{
        "agent": {
                "metrics_collection_interval": 600,
                "run_as_user": "root"
        },
        "logs": {
                "logs_collected": {
                        "files": {
                                "collect_list": [
          {
                                                "file_path": "/var/log/nginx/access_json.log",
                                                "log_group_name": "nginx_access_json",
                                                "log_stream_name": "nginx_access_json"
                                        },
                                        {
                                                "file_path": "/var/www/html/app/storage/logs/laravel.log",
                                                "log_group_name": "log_app",
                                                "log_stream_name": "error_logs"
                                        },
                                        {
                                                "file_path": "/var/www/html/app/storage/logs/worker.log",
                                                "log_group_name": "log_app",
                                                "log_stream_name": "worker_logs"
                                        }
          
                                ]
                        }
                },
    "force_flush_interval" : 900,
                "log_stream_name": "my_log_stream_name"
        },
        "metrics": {
                "aggregation_dimensions": [
                        [
                                "AutoScalingGroupName"
                        ]
                ],
                "append_dimensions": {
                        "AutoScalingGroupName": "${aws:AutoScalingGroupName}",
                        "ImageId": "${aws:ImageId}",
                        "InstanceId": "${aws:InstanceId}",
                        "InstanceType": "${aws:InstanceType}"
                },
                "metrics_collected": {

                        "mem": {
                                "measurement": [
                                        "mem_used_percent"
                                ],
                                "metrics_collection_interval": 60
                        }
                }
        }
}

 













Leave a Reply

Your email address will not be published. Required fields are marked *