Step-by-step guide to monitor logs with Grafana, Loki, and FluentBit #5317
rubens-facilit
started this conversation in
General
Replies: 2 comments 1 reply
-
Attention: It seems that this doesn't work for services deployed via Docker Compose, unfortunately. Does anyone have a clue why, and how to solve it? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Ok, got it!
I'll update the first post. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After struggling for a while to monitor my Coolify apps using Grafana, I finally made it! Here’s a step-by-step tutorial on how to do it with Loki, Grafana, and FluentBit. I have not find any straightforward instructions, so I hope you find it helpful.
1. Deploy Loki and Grafana Services
Deploy Grafana and Loki in a Docker Compose resource:
Note: Replace the Grafana admin password with a strong one.
2. Configure FluentBit on the Server
Update the FluentBit configuration:
Go to Servers >> your server >> Log Drains.
Paste the following into "Custom FluentBit Configuration". Replace the
Host
value with the name of your Loki container.Mark "enabled" and then click save.
3. Connect the Loki Container to the FluentBit Network
Again, replace the Loki container name with yours.
4. Set Environment Variable in Each Service and enable Log Drains
For single Docker resourcers
Define the variable:
In each service container, set the following environment variable:
Go to Advanced >> Drain Logs and activate it.
Restart each container after setting this.
For Docker Compose resourcers
Add this to each service of your docker-compose file:
Redeploy.
5. Access Grafana and Explore Logs
Visit
http://<server_ip>:3000
in your browser.Go to Connections >> Data Sources >> Loki. URL:
http://loki-mcs40ccs40cmcs40ccs40c:3100
. Save and Test.Go to Connections >> Data Sources >> Loki >> Explore and view your logs.
6. Troubleshooting
Check the FluentBit logs by running:
If the logs appear correctly, everything is working and you can now create dashboards to monitor your application logs.
Beta Was this translation helpful? Give feedback.
All reactions