Skip to content

Commit 8892dc8

Browse files
feat: parameterise the MaximumEventAgeInSeconds, LogGroupName, and IAMRoleName for lambda-promtail CloudFormation template (#12728)
1 parent 51a841f commit 8892dc8

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tools/lambda-promtail/template.yaml

+15-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Parameters:
1313
Description: The maximum of concurrent executions you want to reserve for the function.
1414
Type: Number
1515
Default: 2
16+
MaximumEventAgeInSeconds:
17+
Description: The maximum age of a request that Lambda sends to a function for processing.
18+
Type: Number
19+
Default: 21600
1620
Username:
1721
Description: The basic auth username, necessary if writing directly to Grafana Cloud Loki.
1822
Type: String
@@ -51,6 +55,14 @@ Parameters:
5155
Description: Determines whether to verify the TLS certificate
5256
Type: String
5357
Default: "false"
58+
LogGroupName:
59+
Description: Name of the CloudWatch Log Group to subscribe from.
60+
Type: String
61+
Default: "/aws/lambda/some-lamda-log-group"
62+
IAMRoleName:
63+
Description: Name of the LambdaPromtailRole IAM Role.
64+
Type: String
65+
Default: "iam_for_lambda"
5466

5567
Resources:
5668
LambdaPromtailRole:
@@ -78,7 +90,7 @@ Resources:
7890
- logs:PutLogEvents
7991
- logs:PutSubscriptionFilter
8092
Resource: arn:aws:logs:*:*:*
81-
RoleName: iam_for_lambda
93+
RoleName: !Ref IAMRoleName
8294
LambdaPromtailFunction:
8395
Type: AWS::Lambda::Function
8496
Properties:
@@ -119,6 +131,7 @@ Resources:
119131
Properties:
120132
FunctionName: !Ref LambdaPromtailFunction
121133
MaximumRetryAttempts: 2
134+
MaximumEventAgeInSeconds: !Ref MaximumEventAgeInSeconds
122135
Qualifier: !GetAtt LambdaPromtailVersion.Version
123136
# Copy this block and modify as required to create Subscription Filters for
124137
# additional CloudWatch Log Groups.
@@ -128,7 +141,7 @@ Resources:
128141
Properties:
129142
DestinationArn: !GetAtt LambdaPromtailFunction.Arn
130143
FilterPattern: ""
131-
LogGroupName: "/aws/lambda/some-lamda-log-group"
144+
LogGroupName: !Ref LogGroupName
132145

133146
Outputs:
134147
LambdaPromtailFunction:

0 commit comments

Comments
 (0)