forked from taimos/cloudwatch-sumologic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfn.yaml
58 lines (56 loc) · 1.6 KB
/
cfn.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: 'SumoLogic Log forwarder | 1.0.0'
Parameters:
SumoLogicEndpoint:
Type: String
Description: 'URL of the hosted collector'
Resources:
LogFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs6.10
Timeout: 30
CodeUri: log-forwarder
Environment:
Variables:
SUMO_ENDPOINT: !Ref SumoLogicEndpoint
LogGroup:
Type: "AWS::Logs::LogGroup"
Properties:
LogGroupName: !Sub '/aws/lambda/${LogFunction}'
RetentionInDays: 3
LogInvokeLambdaPermission:
Type: 'AWS::Lambda::Permission'
Properties:
FunctionName: !GetAtt LogFunction.Arn
Action: 'lambda:InvokeFunction'
Principal: !Sub logs.${AWS::Region}.amazonaws.com
SourceAccount: !Ref AWS::AccountId
ConfigureFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs6.10
Timeout: 30
CodeUri: loggroup-config
Policies:
Statement:
- Sid: 'AccessToCWLogs'
Effect: "Allow"
Action:
- 'logs:DescribeLogGroups'
- 'logs:DescribeSubscriptionFilters'
- 'logs:PutSubscriptionFilter'
- 'logs:PutRetentionPolicy'
Resource: '*'
Environment:
Variables:
FORWARDER_FUNCTION_NAME: !Ref LogFunction
FORWARDER_FUNCTION_ARN: !GetAtt LogFunction.Arn
Events:
Cron:
Type: Schedule
Properties:
Schedule: rate(5 minutes)