Self hosted logging/analytics for Next apps - Prometheus?
I've recently pushed a Next app to production, but by my boss' wishes we had to do self hosting. So now I'm looking at different self hosted metrics/analytics/logging solutions.
Prometheus looked promising, so I wanted to ask if anyone had experience adding that to a Next app or has any other recommendations?
2 Replies
I'm only using winston so far for my api crawler for logs but sometime next year I plan on deploying to on prem using the following tools for dev ops. Would love to hear what others have to say here.
1. Prometheus: A powerful open-source monitoring and alerting toolkit. It can scrape metrics from your applications and store them in a time-series database.
- prisma-client/metrics
2. Grafana: An open-source platform for monitoring and observability. It can be used with Prometheus to create dashboards that visualize your metrics.
3. Node Exporter: For monitoring the host system on which your Node.js servers are running. It exposes an extensive set of machine-level metrics like CPU, memory, disk usage, etc.
4. MySQL Exporter: A Prometheus exporter for MySQL server metrics. It provides information on MySQL performance.
5. pm2: A process manager for Node.js applications. It comes with basic built-in monitoring and can be used to keep your Node.js applications running and collect statistics on their performance.
6. ELK Stack (Elasticsearch, Logstash, Kibana): A powerful combination for log aggregation, search, and visualization. It's a more complex solution but can provide deep insights into both MySQL and Node.js operations.
Things like data dog seem way too expensive so thats my free tier list of things that I think I want todo. @JulieCezar
@JulieCezar thoughts?
Thank you for the advice 😄
1. I am using prometheus but having specific logs for APIs and stuff like that is a hassle... - I haven't done it successfully yet - and I had a lot of problems with all the non generic metrics from it (but didn't know about prisma plugin, will check it out!)
2. Using grafana as well but the problem is not visualizing just logging 😅
3. Using that as well
4. Using postgres... will see if there is something like that
5. Using that as well but with the free version I find it kind of limiting...
6. I found this one as well and was probably planning to use it, but I'm still trying it out atm
And yeah, ideally everything should be self hosted and free (boss' orders)
For logging, from what I have found now I was planning to use Winston to save the logs to FS, then using the text-colector exporter from Prom to scrape that file occasionally
update: we decided on something similar to the ELK stack, which is PostHog and Plausible, easily intergrateable with NextJS and takes less resources on our VM that running ELK