Installation
We can follow the latest binary install instructions from their GitHub releases.
Download the Loki and Promtail binaries.
curl -O -L "https://github.com/grafana/loki/releases/download/v2.2.0/loki-linux-amd64.zip"
curl -O -L "https://github.com/grafana/loki/releases/download/v2.2.0/promtail-linux-amd64.zip"
unzip "loki-linux-amd64.zip"
unzip "promtail-linux-amd64.zip"
# make sure it is executable
chmod a+x "loki-linux-amd64"
chmod a+x "promtail-linux-amd64"
Configure
Grab the sample configurations for Loki and Promtail:
wget https://raw.githubusercontent.com/grafana/loki/master/cmd/loki/loki-local-config.yaml
wget https://raw.githubusercontent.com/grafana/loki/master/clients/cmd/promtail/promtail-local-config.yaml
The default Loki config should be good, Loki will just have to be started and pointed to the config.
This can be done with a systemd service:
[Unit]
Description=Loki, a log aggregation tool
After=network.target network-online.target
Requires=network-online.target
[Service]
User=loki
Group=loki
ExecStart=/home/loki/loki-linux-amd64 --config.file=/home/loki/loki-local-config.yaml
WorkingDirectory=/home/loki
TimeoutStopSec=5s
[Install]
WantedBy=multi-user.target