diff --git a/hosts/rico1/services/apps/default.nix b/hosts/rico1/services/apps/default.nix index 9d89119..a32782c 100644 --- a/hosts/rico1/services/apps/default.nix +++ b/hosts/rico1/services/apps/default.nix @@ -5,6 +5,7 @@ _: { ./wiki.nix ./alertmanager.nix ./blocky.nix + ./loki ../../../shared/prometheus-exporters.nix ../../../shared/promtail.nix ]; diff --git a/hosts/rico1/services/apps/loki/default.nix b/hosts/rico1/services/apps/loki/default.nix new file mode 100644 index 0000000..7683d81 --- /dev/null +++ b/hosts/rico1/services/apps/loki/default.nix @@ -0,0 +1,23 @@ +_: +let + inherit (import ../../../../shared/caddy-helpers.nix) logFormat; + domainName = "loki.labs.adtya.xyz"; +in +{ + services = { + caddy = { + virtualHosts."${domainName}" = { + logFormat = logFormat domainName; + extraConfig = '' + reverse_proxy 127.0.0.1:3100 + ''; + }; + }; + loki = { + enable = true; + dataDir = "/mnt/data/loki"; + configFile = ./loki-config.yaml; + }; + }; + systemd.services.loki.unitConfig.RequiresMountsFor = [ "/mnt/data" ]; +} diff --git a/hosts/rico1/services/apps/loki/loki-config.yaml b/hosts/rico1/services/apps/loki/loki-config.yaml new file mode 100644 index 0000000..7264c1d --- /dev/null +++ b/hosts/rico1/services/apps/loki/loki-config.yaml @@ -0,0 +1,58 @@ +auth_enabled: false + +server: + http_listen_port: 3100 + grpc_listen_port: 9096 + log_level: info + grpc_server_max_concurrent_streams: 1000 + +common: + instance_addr: 127.0.0.1 + path_prefix: /mnt/data/loki + storage: + filesystem: + chunks_directory: /mnt/data/loki/chunks + rules_directory: /mnt/data/loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory + +query_range: + results_cache: + cache: + embedded_cache: + enabled: true + max_size_mb: 100 + +schema_config: + configs: + - from: 2020-10-24 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + +pattern_ingester: + enabled: true + +ruler: + alertmanager_url: https://alertmanager.labs.adtya.xyz + +frontend: + encoding: protobuf + +# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration +# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/ +# +# Statistics help us better understand how Loki is used, and they show us performance +# levels for most users. This helps us prioritize features and documentation. +# For more information on what's sent, look at +# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go +# Refer to the buildReport method to see what goes into a report. +# +# If you would like to disable reporting, uncomment the following lines: +analytics: + reporting_enabled: false