Skip to content

Instantly share code, notes, and snippets.

@kmcquade
Last active February 27, 2024 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmcquade/f45d5cd47a67fd4809b04e16a034cb6b to your computer and use it in GitHub Desktop.
Save kmcquade/f45d5cd47a67fd4809b04e16a034cb6b to your computer and use it in GitHub Desktop.
cloudwatch logs agent config
{
"agent": {
"metrics_collection_interval": 60
},
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "/home/ec2-user/shared-volume/zap.log",
"log_group_class": "STANDARD",
"log_group_name": "/aws/ec2/home/ec2-user/shared-volume/zap.log",
"log_stream_name": "{instance_id}_{hostname}",
"retention_in_days": -1,
"timezone": "UTC"
},
{
"file_path": "/home/ec2-user/file.log",
"log_group_class": "STANDARD",
"log_group_name": "/aws/ec2/nv-zap/cli.log",
"log_stream_name": "{instance_id}_{hostname}",
"retention_in_days": -1,
"timezone": "UTC"
},
{
"file_path": "/var/log/cloud-init-output.log",
"log_group_class": "STANDARD",
"log_group_name": "/aws/ec2/var/log/cloud-init-output.log",
"log_stream_name": "{instance_id}_{hostname}",
"retention_in_days": -1,
"timezone": "UTC"
},
{
"file_path": "/var/log/cloud-init.log",
"log_group_class": "STANDARD",
"log_group_name": "/aws/ec2/var/log/cloud-init.log",
"log_stream_name": "{instance_id}_{hostname}",
"retention_in_days": -1,
"timezone": "UTC"
},
{
"file_path": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log",
"log_group_class": "STANDARD",
"log_group_name": "/aws/ec2/ec2/CloudWatchAgentLog/",
"log_stream_name": "{instance_id}_{hostname}",
"timezone": "UTC"
},
{
"file_path": "/var/log/messages",
"log_group_class": "STANDARD",
"log_group_name": "/aws/ec2/var/log/messages",
"log_stream_name": "{instance_id}_{hostname}",
"timezone": "UTC"
},
{
"file_path": "/var/log/secure",
"log_group_class": "STANDARD",
"log_group_name": "/aws/ec2/var/log/secure",
"log_stream_name": "{instance_id}_{hostname}",
"timezone": "UTC"
}
]
}
}
},
"metrics": {
"aggregation_dimensions": [
[
"ImageId"
],
[
"InstanceId"
],
[
"InstanceType"
]
],
"append_dimensions": {
"ImageId": "${aws:ImageId}",
"InstanceId": "${aws:InstanceId}",
"InstanceType": "${aws:InstanceType}"
},
"metrics_collected": {
"collectd": {
"metrics_aggregation_interval": 60
},
"disk": {
"measurement": [
"used_percent"
],
"metrics_collection_interval": 60,
"resources": [
"*"
]
},
"mem": {
"measurement": [
"mem_used_percent"
],
"metrics_collection_interval": 60
},
"statsd": {
"metrics_aggregation_interval": 60,
"metrics_collection_interval": 10,
"service_address": ":8125"
}
}
},
"traces": {
"buffer_size_mb": 3,
"concurrency": 8,
"insecure": false,
"region_override": "us-east-1",
"traces_collected": {
"xray": {
"bind_address": "127.0.0.1:2000",
"tcp_proxy": {
"bind_address": "127.0.0.1:2000"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment