|
| 1 | +# The following file configures a new version of cloudwatch logs agent that uses IMDSv2 instead of IMDSv1 |
| 2 | +# to push the /var/app/current/storage/logs/*.log files to a Log Group in CloudWatch Logs. |
| 3 | + |
| 4 | +# This version of CloudWatch Logs agent is installed automatically on Amazon Linux 2 instances. |
| 5 | + |
| 6 | +# The old version of cloudwatch doesn't support Metadata Service Version 2 (IMDSv2) and it's recommended to use a new one |
| 7 | +# Link to reference: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html |
| 8 | + |
| 9 | +# You can then see the CloudWatch Logs by accessing the AWS CloudWatch Console and clicking |
| 10 | +# the "Logs" link on the left. The Log Group name will follow this format: |
| 11 | +# /aws/elasticbeanstalk/<environment name>/<full log name path> |
| 12 | + |
| 13 | +# For more information about "Log Streaming" feature, see: |
| 14 | +# https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html |
| 15 | + |
| 16 | +# Usually, the option_settings with enabled Stream Logs should be uncommented if you are not using IaaC, like Chef or Terraform. |
| 17 | +# If you created the environment manually, uncomment the following lines and set the amount of retention in days. |
| 18 | + |
| 19 | +# Before uncommenting this, please update <environment name> to match yours, or name it as you wish |
| 20 | + |
| 21 | +# option_settings: |
| 22 | +# - namespace: aws:elasticbeanstalk:cloudwatch:logs |
| 23 | +# option_name: StreamLogs |
| 24 | +# value: true |
| 25 | +# - namespace: aws:elasticbeanstalk:cloudwatch:logs |
| 26 | +# option_name: DeleteOnTerminate |
| 27 | +# value: false |
| 28 | +# - namespace: aws:elasticbeanstalk:cloudwatch:logs |
| 29 | +# option_name: RetentionInDays |
| 30 | +# value: 7 |
| 31 | + |
| 32 | +# files: |
| 33 | +# "/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/laravel_logs.json" : |
| 34 | +# mode: "000644" |
| 35 | +# owner: root |
| 36 | +# group: root |
| 37 | +# content: | |
| 38 | +# { |
| 39 | +# "logs": { |
| 40 | +# "logs_collected": { |
| 41 | +# "files": { |
| 42 | +# "collect_list": [ |
| 43 | +# { |
| 44 | +# "file_path": "/var/app/current/storage/logs/*.log", |
| 45 | +# "log_group_name": "/aws/elasticbeanstalk/<environment name>/var/app/current/storage/logs/", |
| 46 | +# "log_stream_name": "{instance_id}" |
| 47 | +# } |
| 48 | +# ] |
| 49 | +# } |
| 50 | +# } |
| 51 | +# } |
| 52 | +# } |
| 53 | + |
| 54 | +# container_commands: |
| 55 | +# start_cloudwatch_agent: |
| 56 | +# command: /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/laravel_logs.json |
0 commit comments