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 Loki
Here 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 Grafana
Grafana is a visualisation tool which supports loki as a data source.
yum install grafana
systemctl start grafana-server
systemctl enable grafana-server
Install Loki
You 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"
unzip "loki-linux-amd64.zip"
Install Promtail
Promtail 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"
unzip promtail-linux-amd64.zip
Download configuration files
We 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.
wget https://raw.githubusercontent.com/grafana/loki/v2.8.6/cmd/loki/loki-local-config.yaml
wget https://raw.githubusercontent.com/grafana/loki/main/clients/cmd/promtail/promtail-local-config.yaml
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 Promtail
Start Loki and Promtail by passing the configuration files
./loki-linux-amd64 -config.file=loki-local-config.yaml
./promtail-linux-amd64 -config.file=promtail-local-config.yaml
Access Grafana
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.
Our Technical Team will be available to assist you with Grafana Loki installation services that can make your job a lot easier. Get in Touch with Skynats if you have any queries.