-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging-lambda-metric-polling.yaml
148 lines (142 loc) · 5.81 KB
/
logging-lambda-metric-polling.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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: New Relic Template to forward logs using S3 bucket or cloudwatch using lambda and metrics using polling from AWS to New Relic
Metadata:
AWS::ServerlessRepo::Application:
Name: NewRelic-log-forwarding
Description: Send log data from AWS to New Relic.
Author: New Relic
SpdxLicenseId: Apache-2.0
LicenseUrl: LICENSE.txt
ReadmeUrl: README.md
HomePageUrl: https://github.com/newrelic/aws-unified-logging #TODO change this url once the repo is public
SemanticVersion: 0.0.17
SourceCodeUrl: https://github.com/newrelic/aws-unified-logging #TODO change this url once the repo is public
AWS::CloudFormation::Interface:
ParameterGroups:
-
Label:
default: 'AWS Integration configuration'
Parameters:
- NewRelicAccountId
- NewRelicRegion
- NewRelicLicenseKey
-
Label:
default: 'AWS Metrics Polling Configuration'
Parameters:
- IntegrationName
- IAMRoleName
- NewRelicAPIKey
- PollingIntegrationSlugs
-
Label:
default: 'AWS Logging Configuration'
Parameters:
- S3BucketNames
- LogGroupConfig
- CommonAttributes
- StoreNRLicenseKeyInSecretManager
ParameterLabels:
IntegrationName:
default: 'Name of integration in NewRelic'
NewRelicAccountId:
default: 'NewRelic account ID'
IAMRoleName:
default: 'Role name for NewRelic'
NewRelicAPIKey:
default: 'NewRelic API Key'
NewRelicRegion:
default: 'New Relic Datacenter Region'
NewRelicLicenseKey:
default: 'New Relic Ingest License Key'
LogGroupConfig:
default: 'Log Groups name & filter (if applicable)'
S3BucketNames:
default: 'S3 bucket Names & Prefix (if applicable)'
CommonAttributes:
default: 'Common Attributes to be added to the log events'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'
Parameters:
IAMRoleName:
Description: Customize the base name of IAM role for New relic AWS integration (the final role name will contain some id at the end)
Type: String
Default: NewRelicInfrastructure-Integrations
NewRelicAccountId:
Type: String
Description: Id of the account in New relic
AllowedPattern: "[0-9]+"
ConstraintDescription: must only contain numbers
NewRelicRegion:
Type: String
Description: Datacenter where the data will be sent (US/EU), DO NOT TOUCH
AllowedValues: [US, EU]
Default: US
IntegrationName:
Type: String
Description: Name of the AWS integration that will be created in New relic
MinLength: 1
MaxLength: 255
AllowedPattern: "[a-zA-Z0-9_-]+"
ConstraintDescription: must only container letters (uppercase and lowercase), numbers, and characters '_', and '-' with max length of 255 total characters
NewRelicAPIKey:
Type: String
Description: New relic user key to use NerdGraph, our GraphQL API, create or get an existing key in https://one.newrelic.com/launcher/api-keys-ui.api-keys-launcher
NoEcho: true
MaxLength: 40
AllowedPattern: "^[^\\s]+$"
ConstraintDescription: "The parameter value cannot be empty, contain spaces, and must be alphanumeric and can contain symbols."
PollingIntegrationSlugs:
Type: CommaDelimitedList
Description: "Comma-delimited list of the polling integrations to configure"
NewRelicLicenseKey:
Type: String
Description: New relic license key, create or get and existing key in https://one.newrelic.com/launcher/api-keys-ui.api-keys-launcher
NoEcho: true
MaxLength: 40
AllowedPattern: "^[^\\s]+$"
ConstraintDescription: "The parameter value cannot be empty, contain spaces, and must be alphanumeric and can contain symbols."
S3BucketNames:
Type: String
Description: "JSON array of objects representing your S3Bucketname and prefixes (if applicable) For example: [{\"bucket\":\"bucket1\",\"prefix\":\"prefix/\"}]"
Default: ""
LogGroupConfig:
Description: "JSON array of objects representing your LogGroup and Filters (if applicable). For example: [{\"LogGroupName\":\"logGroup1\",\"FilterPattern\":\"filter1\"}]"
Type: String
CommonAttributes:
Type: String
Description: "JSON array of objects representing your custom attributes. For example: [{\"AttributeName\":\"key1\",\"AttributeValue\":\"value1\"}]"
Default: ""
StoreNRLicenseKeyInSecretManager:
Type: String
Description: Should we store the New Relic license key in AWS Secrets Manager. Defaults to true.
Default: "true"
AllowedValues:
- "true"
- "false"
Resources:
NewRelicLogsLoggingLambda:
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: lambda-template.yaml
Parameters:
LicenseKey: !Ref NewRelicLicenseKey
NewRelicRegion: !Ref NewRelicRegion
NewRelicAccountId: !Ref NewRelicAccountId
S3BucketNames : !Ref S3BucketNames
LogGroupConfig : !Ref LogGroupConfig
CommonAttributes : !Ref CommonAttributes
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager
# New Relic Metrics Polling Stack
NewrelicMetricsPollingStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://nr-downloads-main.s3.amazonaws.com/cloud_integrations/aws/cloudformation/newrelic-cloudformation-polling.yml
Parameters:
IAMRoleName: !Ref IAMRoleName
NewRelicAccountId: !Ref NewRelicAccountId
NewRelicRegion: !Ref NewRelicRegion
IntegrationName: !Ref IntegrationName
NewRelicAPIKey: !Ref NewRelicAPIKey
PollingIntegrationSlugs: !Join [ "," ,!Ref PollingIntegrationSlugs ]