Documentation
Grafana Loki
Set up
Install
Install locally Install Grafana Loki locally
You can use Grafana Cloud to avoid installing, maintaining, and scaling your own instance of Grafana Loki. Create a free account to get started, which includes free forever access to 10k metrics, 50GB logs, 50GB traces, 500VUh k6 testing & more.
To log events with Grafana Loki, download and install Loki.
- Loki is the logging engine.
- Grafana Alloy is recommended for sending logs to Loki.
The configuration runs Loki as a single binary.
Note
Grafana Loki does not come with any included authentication layer. You must run an authenticating reverse proxy in front of your services to prevent unauthorized access to Loki (for example, nginx). Refer to
Manage authentication for a list of open-source reverse proxies you can use.
Install using APT or RPM package manager
- Add the Grafana Advanced Package Tool (APT) or RPM Package Manager (RPM) package repository following the linked instructions.
- Install Loki
Using dnf
dnf update
dnf install loki
Using apt-get
apt-get update
apt-get install loki
Install manually
Browse to the release page.
Find the Assets section for the version that you want to install.
Download the Loki archive file that corresponds to your system.
Don’t download LogCLI or Loki Canary at this time.
LogCLI allows you to run Loki queries in a command line interface.
Loki Canary is a tool to audit Loki performance.
Extract the package contents into a directory. This is where Loki will run.
In the command line, change directory (cd on most systems) to the directory with Loki.
Copy and paste the following command into your command line to download a generic configuration file.
Use the Git references that match your downloaded Loki version to get the correct configuration file.
For example, if you are using Loki version 3.7.0, you need to use the https://raw.githubusercontent.com/grafana/loki/v3.7.0/cmd/loki/loki-local-config.yaml URL to download the configuration file.
wget https://raw.githubusercontent.com/grafana/loki/main/cmd/loki/loki-local-config.yaml
Run the following command to start Loki:
Windows
.\loki-windows-amd64.exe --config.file=loki-local-config.yaml
Linux
./loki-linux-amd64 -config.file=loki-local-config.yaml
Loki runs and displays Loki logs in your command line and on http://localhost:3100/metrics.
The next step is running an agent to send logs to Loki.
Refer to Grafana Alloy for the recommended log collection agent.
Release binaries - openSUSE Linux only
Every release includes binaries for Loki.
You can find them on the Releases page.
The community provides packages of Loki for openSUSE Linux.
To install them:
Add the repository https://download.opensuse.org/repositories/security:/logging/ to your system.
For example, if you are using Leap 15.1, run:
sudo zypper ar https://download.opensuse.org/repositories/security:/logging/openSUSE_Leap_15.1/security:logging.repo
sudo zypper ref
Install the Loki package:
Start and enable the Loki service:
systemd start loki
systemd enable loki
Modify the /etc/loki/loki.yaml configuration file as needed.