Created
August 8, 2016 05:30
-
-
Save monkey-codes/c2be839f2d37b7b20db27a5dd12cc8e3 to your computer and use it in GitHub Desktop.
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
Mappings: | |
CWLogs: | |
WebRequestLogGroup: | |
TimestampFormat: "%Y-%m-%dT%H:%M:%S.%f%z" | |
Outputs: | |
WebRequestCWLogGroup: | |
Description: "The name of the Cloudwatch Logs Log Group created for this environments web server access logs. You can specify this by setting the value for the environment variable: WebRequestCWLogGroup. 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" : "AWSEBCloudWatchLogsAppLogGroup"} | |
Resources : | |
AWSEBCloudWatchLogsAppLogGroup: | |
Type: "AWS::Logs::LogGroup" | |
DependsOn: AWSEBBeanstalkMetadata | |
DeletionPolicy: Retain | |
Properties: | |
LogGroupName: | |
"Fn::GetOptionSetting": | |
Namespace: "aws:elasticbeanstalk:application:environment" | |
OptionName: WebRequestCWLogGroup | |
DefaultValue: {"Fn::Join":["-", [{ "Ref":"AWSEBEnvironmentName" }, "logs"]]} | |
RetentionInDays: 14 | |
AWSEBAutoScalingGroup: | |
Metadata: | |
"AWS::CloudFormation::Init": | |
CWLogsAgentConfigSetup: | |
files: | |
"/tmp/cwlogs/conf.d/tomcat-catalina.conf": | |
content : | | |
[web_log] | |
file = /var/log/web-1.log | |
log_group_name = `{ "Ref" : "AWSEBCloudWatchLogsAppLogGroup" }` | |
log_stream_name = web | |
datetime_format = `{"Fn::FindInMap":["CWLogs", "WebRequestLogGroup", "TimestampFormat"]}` | |
[web_error_log] | |
file = /var/log/web-1.error.log | |
log_group_name = `{ "Ref" : "AWSEBCloudWatchLogsAppLogGroup" }` | |
log_stream_name = web-error | |
datetime_format = `{"Fn::FindInMap":["CWLogs", "WebRequestLogGroup", "TimestampFormat"]}` | |
mode : "000400" | |
owner : root | |
group : root | |
AWSEBCWLGreetingHitsMetricFilter : | |
Type : "AWS::Logs::MetricFilter" | |
Properties : | |
LogGroupName: { "Ref" : "AWSEBCloudWatchLogsAppLogGroup" } | |
FilterPattern : '{ $.fields_requested_uri = "/greeting"}' | |
MetricTransformations : | |
- MetricValue : 1 | |
MetricNamespace: {"Fn::Join":["/", ["elastic-beanstalk", {"Ref":"AWSEBEnvironmentName"}]]} | |
MetricName : greeting-hits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment