Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus.
In this tutorial, we will guide you through the installation process of Loki on NixOS Latest.
Before we start, you should have:
The first step is to install the Loki package. Open up a terminal and run the following command:
sudo nix-env -i loki
This will install the latest version of Loki on your system.
Next, we need to configure and run Loki. To do this, we need to create a configuration file for Loki.
Create a new configuration file /etc/loki/loki-promtail-config.yml using your favourite editor with the following content:
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
schema_config:
configs:
- from: 2020-04-15
store: boltdb
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb:
directory: /tmp/loki/boltdb
filesystem:
directory: /tmp/loki/chunks
limits_config:
enforced:
max_samples_per_query: 5000000
max_series_per_metric: 100000
chunk_store_config:
max_look_back_period: 0s
table_manager:
retention_deletes_enabled: false
retention_period: 0s
compactor:
working_directory: /tmp/loki/boltdb
shared_store: filesystem
shared_store_directory: /tmp/loki/compactor
compaction:
working_directory: /tmp/loki/boltdb
inertial_compaction:
max_concurrent_compactions: 2
compaction_window: 1h
ignore_deletes: false
retain_period: 0s
Once you have saved the configuration file, you can start the Loki service using the following command:
sudo systemctl start loki.service
You can also enable the service to start at boot time using the following command:
sudo systemctl enable loki.service
Loki should now be up and running. To verify that it is working correctly, you can access the web interface by opening your browser and visiting http://localhost:3100/loki.
Congratulations! You have successfully installed Loki on NixOS Latest.
In this tutorial, we covered the steps necessary to install and configure Loki on NixOS Latest. We hope that you found this tutorial helpful and that you are now able to use Loki to effectively aggregate and search logs on your 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!