summaryrefslogtreecommitdiff
path: root/os/srv/loki.nix
blob: 2388432b7970fac1bf75bb5890802e646c2c0bc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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";
                };
              }
            ];
          };
        }
      );
    };
  };
}