############################################################################### ## Option Settings ## Namespace: "aws:elasticbeanstalk:application:environment" ## OptionName: ActivityCWLogGroup ## Default: -activity ## Description: This is the name of the cloudwatch log group for the activity log ## ############################################################################### Mappings: CWLogs: ActivityLogGroup: LogFile: "/var/log/eb-activity.log" TimestampFormat: "%d/%b/%Y:%H:%M:%S %z" Outputs: ActivityCWLogGroup: Description: "The name of the Cloudwatch Logs Log Group created for this environments activity logs. You can specify this by setting the value for the environment variable: ActivityCWLogGroup. Please note: if you update this value, then you will need to go and clear out the old cloudwatch logs group and delete it through Cloudwatch Logs." Value: { "Ref" : "AWSEBCloudWatchLogsActivityLogGroup"} Resources : AWSEBCloudWatchLogsActivityLogGroup: ## Must have prefix: AWSEBCloudWatchLogs Type: "AWS::Logs::LogGroup" DependsOn: AWSEBBeanstalkMetadata DeletionPolicy: Retain ## this is required Properties: LogGroupName: "Fn::GetOptionSetting": Namespace: "aws:elasticbeanstalk:application:environment" OptionName: ActivityCWLogGroup DefaultValue: {"Fn::Join":["-", ["awseb", { "Ref":"AWSEBEnvironmentName" }, "activity"]]} RetentionInDays: 7 ## Register the files/log groups for monitoring AWSEBAutoScalingGroup: Metadata: "AWS::CloudFormation::Init": CWLogsAgentConfigSetup: files: ## any .conf file put into /tmp/cwlogs/conf.d will be added to the cwlogs config (see cwl-agent.config) "/tmp/cwlogs/conf.d/activity-logs.conf": content : | [activity_log] file = `{"Fn::FindInMap":["CWLogs", "ActivityLogGroup", "LogFile"]}` log_group_name = `{ "Ref" : "AWSEBCloudWatchLogsActivityLogGroup" }` log_stream_name = {instance_id} datetime_format = `{"Fn::FindInMap":["CWLogs", "ActivityLogGroup", "TimestampFormat"]}` mode : "000400" owner : root group : root