Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite lambda-promtail to use subscription filters. #4315

Merged
merged 9 commits into from
Sep 28, 2021
Merged

Rewrite lambda-promtail to use subscription filters. #4315

merged 9 commits into from
Sep 28, 2021

Conversation

cstyan
Copy link
Contributor

@cstyan cstyan commented Sep 13, 2021

Minor code changes to main.go, the only code config value needed is the write address. Configuration of CloudWatch subscription filters (previously just configuration of Log Groups to make API calls for) and other AWS side config is done via either the Terraform or CloudFormation files. We also now build the Go code into a docker image; this image needs to be uploaded to an ECR repo to be used by end users in their Lambda deployments.

Probably still some README improvements/initial details that can be added but this works ™️

Signed-off-by: Callum Styan callumstyan@gmail.com

@cstyan cstyan requested a review from owen-d September 13, 2021 06:15
@cstyan cstyan requested a review from a team as a code owner September 13, 2021 06:15
@cstyan
Copy link
Contributor Author

cstyan commented Sep 13, 2021

XXL tag is due to vendoring changes.

@cstyan
Copy link
Contributor Author

cstyan commented Sep 15, 2021

@julienduchesne let me know if you have any comments on the lambda/terraform here :)

Copy link
Member

@julienduchesne julienduchesne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only looked at Terraform stuff. LGTM other than some nits

tools/lambda-promtail/main.tf Outdated Show resolved Hide resolved
tools/lambda-promtail/main.tf Outdated Show resolved Hide resolved
tools/lambda-promtail/main.tf Outdated Show resolved Hide resolved
tools/lambda-promtail/main.tf Outdated Show resolved Hide resolved
tools/lambda-promtail/main.tf Outdated Show resolved Hide resolved
tools/lambda-promtail/main.tf Outdated Show resolved Hide resolved
Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyan
Copy link
Contributor Author

cstyan commented Sep 17, 2021

@julienduchesne thanks for the review!

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the binary file and use variables when appropriate. I don't think it's a nice experience needing to comment/uncomment and/or sed parts of the terraform/cloudformation.
image

memory_size = 128
package_type = "Image"

# vpc_config {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we expose this in a conditional configuration rather than via comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a look at terraform docs for doing this.

tools/lambda-promtail/template.yaml Outdated Show resolved Hide resolved
Properties:
DestinationArn: !GetAtt LambdaPromtailFunction.Arn
FilterPattern: ""
LogGroupName: "/aws/lambda/some-lamda-log-group"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, let's use parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one I'd prefer to leave as is, since it's more likely than not that users will have multiple log groups that they want to subscribe to, with different FilterPatterns per group.

However, I'll have a look at if there's a nice way to duplicate a terraform config block with an array as an input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately there isn't a nice built in way to repeat a resource block in CloudFormation based on a list of variables, but I have made that change to the Terraform file. IMO it's best if users copy paste this section for CloudFormation until we find a better option here.

tools/lambda-promtail/main.tf Outdated Show resolved Hide resolved
vars.

Signed-off-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
the write endpoint and log groups to subscribe to.

Signed-off-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
commands in readme

Signed-off-by: Callum Styan <callumstyan@gmail.com>
VPC config for promtail-lambda deployment.

Signed-off-by: Callum Styan <callumstyan@gmail.com>
@owen-d owen-d merged commit 05bb3ce into grafana:main Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants