feat: add Loki datasource configuration for Grafana

This commit is contained in:
2025-05-31 19:30:04 +02:00
parent 7fc3c3db63
commit 39b9726be7
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
{ lib, pkgs, config, ... }:
{
services.grafana.provision.datasources.settings.datasources = [
{
name = "Loki";
uid = "loki-datasource-uid"; # Stable UID
type = "loki";
url = "http://localhost:3100"; # Loki's local address
access = "proxy"; # Grafana proxies requests
isDefault = false; # Can be set to true if desired
jsonData = {
# Loki-specific options (e.g., derivedFields) can go here
};
editable = false; # Recommended for provisioned datasources
}
];
}

View File

@@ -38,6 +38,7 @@ in
./alerting/service/default.nix # Added: Imports the new service alerts module ./alerting/service/default.nix # Added: Imports the new service alerts module
# ... other rule files can be added here ... # ... other rule files can be added here ...
./datasources/victoriametrics.nix ./datasources/victoriametrics.nix
./datasources/loki.nix # Add Loki datasource
]; ];
systemd.services.grafana.script = lib.mkBefore '' systemd.services.grafana.script = lib.mkBefore ''