summaryrefslogtreecommitdiff
path: root/os/srv/loki.nix
diff options
context:
space:
mode:
Diffstat (limited to 'os/srv/loki.nix')
-rw-r--r--os/srv/loki.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/os/srv/loki.nix b/os/srv/loki.nix
new file mode 100644
index 0000000..2388432
--- /dev/null
+++ b/os/srv/loki.nix
@@ -0,0 +1,57 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+let
+ cfg = config.os.srv.loki;
+in
+{
+ options.os.srv.loki.enable = lib.mkEnableOption "enables loki";
+ config = lib.mkIf cfg.enable {
+ services.loki = {
+ enable = true;
+ configFile = pkgs.writeText "loki-config.yaml" (
+ builtins.toJSON {
+ auth_enabled = false;
+ server = {
+ http_listen_port = 3100;
+ };
+ common = {
+ ring = {
+ kvstore = {
+ store = "inmemory";
+ };
+ };
+ instance_interface_names = [ "lo" ];
+ };
+ ingester = {
+ lifecycler = {
+ address = "127.0.0.1";
+ };
+ };
+ storage_config = {
+ filesystem = {
+ directory = "/var/lib/loki/chunks";
+ };
+ };
+ schema_config = {
+ configs = [
+ {
+ from = "2020-10-24";
+ store = "tsdb";
+ object_store = "filesystem";
+ schema = "v13";
+ index = {
+ prefix = "index_";
+ period = "24h";
+ };
+ }
+ ];
+ };
+ }
+ );
+ };
+ };
+}