https://github.com/khuzama98/logs-drain
A custom logs drain vercel integration app which stores logs receives from vercel to mongoDB and then after every 24 hour cron job saves those logs to S3 bucket.
https://github.com/khuzama98/logs-drain
logging mongodb nextjs prisma s3-bucket vercel
Last synced: 2 months ago
JSON representation
A custom logs drain vercel integration app which stores logs receives from vercel to mongoDB and then after every 24 hour cron job saves those logs to S3 bucket.
- Host: GitHub
- URL: https://github.com/khuzama98/logs-drain
- Owner: khuzama98
- License: mit
- Created: 2022-10-18T18:37:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-23T17:36:40.000Z (over 3 years ago)
- Last Synced: 2025-06-03T07:28:33.779Z (about 1 year ago)
- Topics: logging, mongodb, nextjs, prisma, s3-bucket, vercel
- Language: TypeScript
- Homepage: https://logs-drain.vercel.app/
- Size: 134 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Custom Logs Drain App
## Intro:
The app helps to drain logs from your deployed vercel App and persist the logs in AWS S3 bucket.
## Getting Started:
1. Clone the repo.
2. Create an integration on vercel for Log Drain.
3. Create an IAM User & S3 Bucket on AWS.
4. Change .env.example to .env and add your Keys.
5. Deploy the repo to vercel.
6. Add Redirect Uri.
Your custom is now ready to be used, Open your primary app and in integrations section go to your custom log drain and integrate it to your custom logs drain.
## Flow:
There are 3 routes in this app.
- /api/callback - which is used for making integrations with primary apps.
- /api/store - which is used for storing the logs to mongoDB when recieved from vercel.
- /api/batch - which is used for cron job, triggered with the help of github actions, currently set to be triggered after every 24 hours at 00:00 am.
NOTE: The batch size of logs which is saved to S3 controlled from env variable called `BATCH_SIZE` in number of logs you want to add in the batch.
## Structure:
You can find all the actions in the action folder.
- aws.ts - contains action to store batched logs file to S3 bucket.
- callback.ts - contains the actions related to the integration with primary app.
- logStorage.ts - contains all the CRUD actions related to logs to MongoDB.
-----
## Deployed Version
If you want to try deployed version you can try it on.
- https://vercel.com/integrations/custom-logs-drain