Grafana Loki is a log aggregation system that was inspired by Prometheus. It is intended to be inexpensive, simple to use, and highly scalable for gathering, storing, and querying massive amounts of log data. Loki is an open-source project within the Grafana Labs umbrella.
Skynats, as a part of our Server Management Service, is using Grafana Loki services to monitor server logs and identify the issues with no time.
Main Advantages of LokiHere are 3 major advantages of Loki
- Log Aggregation: Loki enables you to consolidate logs from numerous sources into a single system for better administration and analysis.
- Cost-effective: Loki is meant to be storage-efficient, making it possible to retain vast amounts of log data over time.
- Scalability: Loki is designed to handle large amounts of log data and is horizontally scalable, allowing you to expand your log aggregating infrastructure as your requirements change.
Install GrafanaGrafana is a visualisation tool which supports loki as a data source.
yum install grafana
systemctl start grafana-server
systemctl enable grafana-server
Install LokiYou could download the latest version of Loki from github.
curl -O -L "https://github.com/grafana/loki/releases/download/v2.8.6/loki-linux-amd64.zip"
Install PromtailPromtail is the client which fetches the logs and forwards it to loki. In your client system, download the Promtail version that matches the Loki version you downloaded earlier.
curl -O -L "https://github.com/grafana/loki/releases/download/v2.8.6/promtail-linux-amd64.zip"
Download configuration filesWe need a sample configuration file for both Loki and Promtail to work. After downloading the sample configuration, we could make changes according to our requirement in the configuration file.
In the configuration file Promtail, the IP address of the server needs to be provided in the url section of the yaml file. Also, the log file that needs to be checked can be provided in the “Path” section. By default, it will be /var/log/*log
Start Loki and PromtailStart Loki and Promtail by passing the configuration files
1. Grafana can be accessed with the format, IP address:3000 2. Add your first data source URL as, IP address:3100 3. After successful addition of data source, check log files with explore option.