Application error logs using loki

Architecture


• Promtail → Agent which read the log for log file.
• Loki → server
• Grafana → Data visualization tool to disply logs for different different visualization panels like time-series, bar chart , stat visualization.
• Using loki query fetch data from server and disply on Grafana widgets
Step 1 : Folder structure

Make these folder and file.


Step 2 : Downlode loki. Exe and promtail.exe file form github.

image
image
Now open notepad and configure loki and promtail configuration file
loki configuration file



promtail configuration file

Run command to start loki and then promtail

loki-windows-amd64.exe -config.file=loki-config.yaml

promtail-windows-amd64.exe -config.file=promtail-config.yaml



Step 3:

Now import the application-error-logs Json in grafana

Step 4:

Loki query to fetch logs by loki server and display on grafana panels

Note : Logs display according to time


Application Errors

Application Warnings:

Total error count

Final Output: