-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from galabl/master
[feature] Added new version of Cloudwatch agent log streaming that is recommended for Amazon Linux 2
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# The following file configures a new version of cloudwatch logs agent that uses IMDSv2 instead of IMDSv1 | ||
# to push the /var/app/current/storage/logs/*.log files to a Log Group in CloudWatch Logs. | ||
|
||
# This version of CloudWatch Logs agent is installed automatically on Amazon Linux 2 instances. | ||
|
||
# The old version of cloudwatch doesn't support Metadata Service Version 2 (IMDSv2) and it's recommended to use a new one | ||
# Link to reference: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html | ||
|
||
# You can then see the CloudWatch Logs by accessing the AWS CloudWatch Console and clicking | ||
# the "Logs" link on the left. The Log Group name will follow this format: | ||
# /aws/elasticbeanstalk/<environment name>/<full log name path> | ||
|
||
# For more information about "Log Streaming" feature, see: | ||
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html | ||
|
||
# Usually, the option_settings with enabled Stream Logs should be uncommented if you are not using IaaC, like Chef or Terraform. | ||
# If you created the environment manually, uncomment the following lines and set the amount of retention in days. | ||
|
||
# Before uncommenting this, please update <environment name> to match yours, or name it as you wish | ||
|
||
# option_settings: | ||
# - namespace: aws:elasticbeanstalk:cloudwatch:logs | ||
# option_name: StreamLogs | ||
# value: true | ||
# - namespace: aws:elasticbeanstalk:cloudwatch:logs | ||
# option_name: DeleteOnTerminate | ||
# value: false | ||
# - namespace: aws:elasticbeanstalk:cloudwatch:logs | ||
# option_name: RetentionInDays | ||
# value: 7 | ||
|
||
# files: | ||
# "/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/laravel_logs.json" : | ||
# mode: "000644" | ||
# owner: root | ||
# group: root | ||
# content: | | ||
# { | ||
# "logs": { | ||
# "logs_collected": { | ||
# "files": { | ||
# "collect_list": [ | ||
# { | ||
# "file_path": "/var/app/current/storage/logs/*.log", | ||
# "log_group_name": "/aws/elasticbeanstalk/<environment name>/var/app/current/storage/logs/", | ||
# "log_stream_name": "{instance_id}" | ||
# } | ||
# ] | ||
# } | ||
# } | ||
# } | ||
# } | ||
|
||
# container_commands: | ||
# start_cloudwatch_agent: | ||
# 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 |