-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtemplate.yml
85 lines (79 loc) · 3.19 KB
/
template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Metadata:
AWS::ServerlessRepo::Application:
Name: cw-logs-to-slack
Description: Filters CloudWatch logs and publishes them to Slack
Author: Keeton Hodgson
SpdxLicenseId: MIT
# paths are relative to .aws-sam/build directory
LicenseUrl: ./LICENSE
ReadmeUrl: ./README.md
Labels: [serverless,slack,CloudWatch,logs]
HomePageUrl: https://github.com/keetonian/cw-logs-to-slack
# Update the semantic version and run sam publish to publish a new version of your app
SemanticVersion: 1.0.0
# best practice is to use git tags for each release and link to the version tag as your source code URL
SourceCodeUrl: https://github.com/keetonian/cw-logs-to-slack/tree/1.0.0
Parameters:
LogLevel:
Type: String
Description: Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc
Default: INFO
SlackUrl:
Description: Webhook URL for integration with Slack
Type: String
LogGroupName:
Description: Log group to listen to (has to be in same account and region)
Type: String
FilterPattern:
Description: Pattern for filtering log events
Type: String
Default: ERROR
OnlySendLogMessage:
Type: String
Default: 'False'
Description: By default, this applicaiton will send the log message, id, and timestamp, unless this is set to True
AllowedValues: ['True','False']
Resources:
cwlogstolambda:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:289559741701:applications/cw-logs-to-lambda
SemanticVersion: 0.0.1
Parameters:
# Name of the function to which this application will send log messages
DestinationFunctionName: !GetAtt lambdatoslack.Outputs.LambdaToSlackName
# Pattern for filtering log events
FilterPattern: !Ref FilterPattern
# Log group to listen to (has to be in same account and region)
LogGroupName: !Ref LogGroupName
# Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc
LogLevel: !Ref LogLevel
# By default, this function will send the log message, id, and timestamp, unless this is set to True
OnlySendLogMessage: !Ref OnlySendLogMessage
lambdatoslack:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:289559741701:applications/lambda-to-slack
SemanticVersion: 0.0.1
Parameters:
# Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc
LogLevel: !Ref LogLevel
# Webhook URL for integration with Slack
SlackUrl: !Ref SlackUrl
Outputs:
LogsToLambdaName:
Description: "Log Lambda Function Name"
Value: !GetAtt cwlogstolambda.Outputs.LogsToLambdaName
LogsToLambdaArn:
Description: "Log Lambda Function ARN"
Value: !GetAtt cwlogstolambda.Outputs.LogsToLambdaArn
LambdaToSlackName:
Description: "Slack Lambda Function Name"
Value: !GetAtt lambdatoslack.Outputs.LambdaToSlackName
LambdaToSlackArn:
Description: "Slack Lambda Function ARN"
Value: !GetAtt lambdatoslack.Outputs.LambdaToSlackArn