Grafana Loki

Grafana Loki is a log aggregation system designed to store and query logs from all your applications and infrastructure.

Getting Started

# In `perSystem.process-compose.<name>`
{
  services.loki."tp1".enable = true;
}

Tips & Tricks

Usage with Grafana

To add loki as a datasource to Grafana, we can use the following config:

{
  services.loki.tp1.enable = true;
  services.grafana.gf1 = {
    enable = true;
    datasources = with config.services.loki.tp1; [{
      name = "Loki";
      type = "loki";
      access = "proxy";
      url = "http://${httpAddress}:${builtins.toString httpPort}";
    }];
  };
  settings.processes."gf1".depends_on."tp1".condition = "process_healthy";
}