How to Install Loki on Arch Linux
Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus. In this tutorial, we will see how we can install Loki on Arch Linux.
Prerequisites
Before starting, make sure that you have the following:
- A Arch Linux machine with root access or a user with sudo privileges.
- Internet Connection
Step 1: Install Go language
Loki is written in Go language, so you need to install Go on your Arch Linux machine.
$ sudo pacman -S go
Step 2: Download and Install Loki
Go to the Loki download page and download the latest stable release.
Extract the downloaded file using the following command.
$ tar xfz loki-linux-amd64.tar.gz
- Move the extracted binary file to the
/usr/local/bindirectory.
$ sudo mv loki-linux-amd64 /usr/local/bin/loki
Step 3: Create Loki Configuration File
Create a configuration file for Loki named loki-config.yaml in /etc directory.
$ sudo mkdir -p /etc/loki/
$ sudo touch /etc/loki/loki-config.yaml
Now open loki-config.yaml and add the following configuration. This is just an example, you can customize the configuration according to your needs.
auth_enabled: false
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 15m
max_chunk_age: 1h
chunk_target_size: 1048576
chunk_retain_period: 30s
max_transfer_retries: 0
schema_config:
configs:
- from: 2018-04-15
store: boltdb
object_store: filesystem
schema: v9
index:
prefix: index_
period: 24h
storage_config:
boltdb:
directory: /tmp/loki/index
limits_config:
ingestion_rate_mb: 10
ingestion_burst_size_mb: 20
Step 4: Create Systemd Service
Create a systemd service file for Loki in /etc/systemd/system directory.
$ sudo touch /etc/systemd/system/loki.service
Open loki.service file and add the following configuration.
[Unit]
Description=Loki service
After=network.target
[Service]
Type=simple
Restart=on-failure
ExecStart=/usr/local/bin/loki -config.file /etc/loki/loki-config.yaml
[Install]
WantedBy=multi-user.target
Step 5: Reload Systemd and Start Loki
Reload the systemd configuration and start the Loki service.
$ sudo systemctl daemon-reload
$ sudo systemctl start loki
Verify that the Loki service is running by checking its status.
$ sudo systemctl status loki
Conclusion
In this tutorial, we have learned how to install Loki on Arch Linux along with creating the configuration and systemd service file. You can customize the configuration as per your needs to start using Loki.