Skip to content

Commit

Permalink
Merge pull request #46 from maxvisser/master
Browse files Browse the repository at this point in the history
EB config file to stream laravel log to cloudwatch
  • Loading branch information
rennokki authored Apr 30, 2021
2 parents f3e0eec + 8a8d8a5 commit 8f38552
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .ebextensions/01_logs_streamtocloudwatch.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# The following file installs and configures the AWS CloudWatch Logs agent
# to push the /var/app/current/storage/logs/laravel.log file to a Log Group in CloudWatch Logs.

# 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:
## http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.cloudwatchlogs.html

## This file was templated based on the following example:
## https://github.com/awsdocs/elastic-beanstalk-samples/blob/master/configuration-files/aws-provided/instance-configuration/logs-streamtocloudwatch-linux.config

# 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.

# 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

packages:
yum:
awslogs: []

# To enable the AWS logs configuration, uncomment the following lines. This will configure your EC2 instance
# to install and configure the AWS Cloudwatch Logs agent to stream your storage/logs/laravel.log file.

# files:
# "/etc/awslogs/awscli.conf" :
# mode: "000600"
# owner: root
# group: root
# content: |
# [plugins]
# cwlogs = cwlogs
# [default]
# region = `{"Ref":"AWS::Region"}`
#
# "/etc/awslogs/awslogs.conf" :
# mode: "000600"
# owner: root
# group: root
# content: |
# [general]
# state_file = /var/lib/awslogs/agent-state
#
# "/etc/awslogs/config/logs.conf" :
# mode: "000600"
# owner: root
# group: root
# content: |
# [/var/app/current/storage/logs]
# datetime_format = %Y-%m-%d %H:%M:%S
# log_group_name = `{"Fn::Join":["/", ["/aws/elasticbeanstalk", { "Ref":"AWSEBEnvironmentName" }, "var/app/current/storage/logs"]]}`
# log_stream_name = {instance_id}
# timestamp_format = '[%Y-%m-%d %H:%M:%S]'
# file = /var/app/current/storage/logs/laravel.log
# buffer_duration = 5000
# use_gzip_http_content_encoding = true
# multi_line_start_pattern = {datetime_format}

# commands:
# "01_enable_aws_log_daemon":
# command: systemctl enable awslogsd.service
# "02_restart_aws_log_daemon":
# command: systemctl restart awslogsd

0 comments on commit 8f38552

Please sign in to comment.