Grafana – Install Loki
A Loki-based logging stack consists of 3 components:
- Promtail is the agent, responsible for gathering logs and sending them to Loki.
- Loki is the main server, responsible for storing logs and processing queries.
- Grafana for querying and displaying the logs.
- Download Loki
wget https://github.com/grafana/loki/releases/download/v2.9.8/loki-linux-amd64.zip
chmod a+x loki-linux-amd64
sudo cp loki-linux-amd64 /usr/local/bin/loki
loki --version
- Create Systemd service
sudo nano /etc/systemd/system/loki.service
[Unit]
Description=Loki is a log aggregation system designed to store and query logs from all your applications and infrastructure.
Document=https://github.com/grafana/loki/releases
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/loki -config.file /mnt/data/loki/loki-config.yaml
Restart=on-failure
RestartSec=10
StandardOutput=append:/mnt/data/loki/logs/loki.log
StandardError=append:/mnt/data/loki/logs/loki.log
[Install]
WantedBy=multi-user.target
# This is a complete configuration to deploy Loki backed by the filesystem.
# The index will be shipped to the storage via tsdb-shipper.
auth_enabled: false
server:
http_listen_port: 3100
common:
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
replication_factor: 1
path_prefix: /mnt/data/loki
storage:
filesystem:
chunks_directory: /mnt/data/loki/chunks
rules_directory: /mnt/data/loki/rules
schema_config:
configs:
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
storage_config:
filesystem:
directory: /mnt/data/loki/chunks
Promtail
PROMTAIL_VERSION=$(curl -s "https://api.github.com/repos/grafana/loki/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
sudo mkdir /opt/promtail
sudo wget -qO /opt/promtail/promtail.gz "https://github.com/grafana/loki/releases/download/v${PROMTAIL_VERSION}/promtail-linux-amd64.zip"
sudo gunzip /opt/promtail/promtail.gz
sudo chmod a+x /opt/promtail/promtail
sudo ln -s /opt/promtail/promtail /usr/local/bin/promtail
sudo wget -qO /opt/promtail/promtail-local-config.yaml "https://raw.githubusercontent.com/grafana/loki/v${PROMTAIL_VERSION}/clients/cmd/promtail/promtail-local-config.yaml"
sudo nano /etc/systemd/system/promtail.service
[Unit]
Description=Promtail client for sending logs to Loki
Documentation=https://grafana.com/docs/loki/latest/send-data/promtail/
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/promtail/promtail -config.file=/opt/promtail/promtail-local-config.yaml
Restart=always
TimeoutStopSec=3
[Install]
WantedBy=multi-user.target
Achieving accurate network performance benchmarks requires ensuring that other hardware components do not introduce system bottlenecks. When configuring complex microservices or container stacks, utilizing lightweight hardware options helps distribute computing resources evenly across your network clusters. Therefore, administrators can explore our technical guide on the [Intel NUC Skull Canyon review] to learn how to repurpose compact, energy-efficient legacy devices as dedicated logging agent nodes within their modern high-availability infrastructure layouts.

