Skip to content

Commit 70e9901

Browse files
author
claudfuen
committed
feat: improve Better Stack logging infrastructure
- Fix RDS log group naming to use db.identifier instead of db.id - Add automatic dependency installation for Lambda function using Pulumi Command - Remove manual npm install requirement from deployment process - Add comprehensive setup documentation in comments - Ensure subscription filters work for both ECS and RDS logs automatically - Make Better Stack integration plug-and-play for new users Users now only need to: 1. Update BETTER_STACK_ENTRYPOINT and BETTER_STACK_SOURCE_TOKEN 2. Run pulumi up Dependencies are automatically installed during deployment.
1 parent 7a6cd76 commit 70e9901

File tree

3 files changed

+208
-1
lines changed

3 files changed

+208
-1
lines changed

apps/infra/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as aws from "@pulumi/aws";
22
import * as awsx from "@pulumi/awsx";
33
import * as pulumi from "@pulumi/pulumi";
4+
import * as command from "@pulumi/command";
45
import * as random from "@pulumi/random";
56

67
// ==========================================
@@ -589,6 +590,16 @@ new aws.iam.RolePolicyAttachment(
589590
}
590591
);
591592

593+
594+
// Automatically install Lambda dependencies during deployment
595+
const installLambdaDeps = new command.local.Command("install-lambda-deps", {
596+
create: "npm install --production",
597+
dir: "../../logtail-aws-lambda",
598+
environment: {
599+
NODE_ENV: "production",
600+
},
601+
});
602+
592603
// Create a deployment package for the Lambda function
593604
const betterStackLambdaPackage = new pulumi.asset.FileArchive(
594605
"../../logtail-aws-lambda"
@@ -617,7 +628,8 @@ const betterStackLambda = new aws.lambda.Function(
617628
Name: "pathfinder-better-stack-lambda",
618629
Type: "log-forwarder",
619630
},
620-
}
631+
},
632+
{ dependsOn: [installLambdaDeps] }
621633
);
622634

623635
// CloudWatch subscription filters to forward ALL logs to Better Stack

apps/infra/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"dependencies": {
99
"@pulumi/aws": "^6.83.0",
1010
"@pulumi/awsx": "^2.22.0",
11+
"@pulumi/command": "^1.1.0",
1112
"@pulumi/pulumi": "^3.181.0",
1213
"@pulumi/random": "^4.18.2"
1314
}

logtail-aws-lambda/package-lock.json

Lines changed: 194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)