-
-
Save oelgoubi/32650b83e483e34f67ef9ba2b37c5ce8 to your computer and use it in GitHub Desktop.
AWS CloudWatch Agent configuration file example for Linux with standard /var/log/messages, secure, and yum logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"agent": { | |
"metrics_collection_interval": 10, | |
"logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log" | |
}, | |
"metrics": { | |
"metrics_collected": { | |
"cpu": { | |
"resources": [ | |
"*" | |
], | |
"measurement": [ | |
{"name": "cpu_usage_idle", "rename": "CPU_USAGE_IDLE", "unit": "Percent"}, | |
{"name": "cpu_usage_nice", "unit": "Percent"}, | |
"cpu_usage_guest" | |
], | |
"totalcpu": false, | |
"metrics_collection_interval": 10, | |
"append_dimensions": { | |
"customized_dimension_key_1": "customized_dimension_value_1", | |
"customized_dimension_key_2": "customized_dimension_value_2" | |
} | |
}, | |
"disk": { | |
"resources": [ | |
"/", | |
"/tmp" | |
], | |
"measurement": [ | |
{"name": "free", "rename": "DISK_FREE", "unit": "Gigabytes"}, | |
"total", | |
"used" | |
], | |
"ignore_file_system_types": [ | |
"sysfs", "devtmpfs" | |
], | |
"metrics_collection_interval": 60, | |
"append_dimensions": { | |
"customized_dimension_key_3": "customized_dimension_value_3", | |
"customized_dimension_key_4": "customized_dimension_value_4" | |
} | |
}, | |
"diskio": { | |
"resources": [ | |
"*" | |
], | |
"measurement": [ | |
"reads", | |
"writes", | |
"read_time", | |
"write_time", | |
"io_time" | |
], | |
"metrics_collection_interval": 60 | |
}, | |
"swap": { | |
"measurement": [ | |
"swap_used", | |
"swap_free", | |
"swap_used_percent" | |
] | |
}, | |
"mem": { | |
"measurement": [ | |
"mem_used", | |
"mem_cached", | |
"mem_total" | |
], | |
"metrics_collection_interval": 10 | |
}, | |
"net": { | |
"resources": [ | |
"eth0" | |
], | |
"measurement": [ | |
"bytes_sent", | |
"bytes_recv", | |
"drop_in", | |
"drop_out" | |
] | |
}, | |
"netstat": { | |
"measurement": [ | |
"tcp_established", | |
"tcp_syn_sent", | |
"tcp_close" | |
], | |
"metrics_collection_interval": 60 | |
}, | |
"processes": { | |
"measurement": [ | |
"running", | |
"sleeping", | |
"dead" | |
] | |
} | |
}, | |
"append_dimensions": { | |
"ImageId": "${aws:ImageId}", | |
"InstanceId": "${aws:InstanceId}", | |
"InstanceType": "${aws:InstanceType}", | |
"AutoScalingGroupName": "${aws:AutoScalingGroupName}" | |
}, | |
"aggregation_dimensions" : [["ImageId"], ["InstanceId", "InstanceType"], ["d1"],[]] | |
}, | |
"logs": { | |
"logs_collected": { | |
"files": { | |
"collect_list": [ | |
{ | |
"file_path": "/var/log/nginx/access.log", | |
"log_group_name": "access_and_error_log", | |
"log_stream_name": "{instance_id}" | |
}, | |
{ | |
"file_path": "/var/log/nginx/error.log", | |
"log_group_name": "error.log", | |
"log_stream_name": "{instance_id}" | |
}, | |
{ | |
"file_path": "/var/log/syslog", | |
"log_group_name": "sysLog", | |
"log_stream_name": "{instance_id}" | |
}, | |
{ | |
"file_path": "/var/log/mongodb/mongodb.log", | |
"log_group_name": "mongodbLog", | |
"log_stream_name": "{instance_id}" | |
} | |
] | |
} | |
}, | |
"log_stream_name": "/ec2/catchall" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment