Loki is a log aggregation system inspired by Prometheus. It can be used to collect, store and query logs from various sources in a distributed environment. In this tutorial, we will guide you through the installation process of Loki on Linux Mint.
Before we begin, please make sure that your system has the following requirements:
Docker is a containerization platform that allows you to run applications in isolated and portable environments. To install Docker on Linux Mint, follow these steps:
Open the Terminal by pressing CTRL + ALT + T
key combination.
Run the following command to update your system’s package index:
sudo apt update
docker.io
package using the following command:sudo apt install docker.io
docker --version
You should now see the Docker version installed on your system.
Now that we have Docker installed on our system, we can proceed to install Loki.
Open the Terminal by pressing CTRL + ALT + T
key combination.
Create a new directory for the Loki configuration file and change the directory to the newly created directory:
mkdir -p ~/loki/config && cd ~/loki/config
loki-config.yaml
using the following command:nano loki-config.yaml
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: 5m
chunk_retain_period: 30s
schema_config:
configs:
- from: 2021-06-01
store: boltdb
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb:
directory: /tmp/loki/index
filesystem:
directory: /tmp/loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0s
table_manager:
chunk_tables_provisioning:
inactive_read_throughput: 0
inactive_write_throughput: 0
provisioned_read_throughput: 0
provisioned_write_throughput: 0
provisioned_write_capacity_auto_scaling: true
retention_deletes_enabled: false
retention_period: 0s
sudo docker run -d --name loki -p 3100:3100 -v ~/loki/config:/etc/loki --restart always grafana/loki:latest -config.file=/etc/loki/loki-config.yaml
In the above command:
-d
flag runs the container in the background (detached mode).--name
option sets the name of the container.-p
option maps the container port to the host port.-v
option mounts the host directory to the container's directory.--restart
option restarts the container automatically.grafana/loki:latest
is the name of the Docker image.-config.file
option points to the location of the configuration file.sudo docker ps
You should now see the Loki container running in the list of active containers.
Now that we have installed Loki, we can verify that it is working by accessing the Loki Web UI.
Open a web browser.
Visit http://localhost:3100/ and you should see the Loki user interface.
Click on the "Explore" button in the top-left corner of the screen.
You can now query logs from any of the available targets.
Congratulations! You have successfully installed Loki on your Linux Mint system.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!