parent
ad993301b1
commit
22c5ff7adc
5 changed files with 45 additions and 37 deletions
|
@ -5,10 +5,10 @@
|
|||
./nix.nix
|
||||
./sops.nix
|
||||
./wireguard.nix
|
||||
./services/loki.nix
|
||||
./home.nix
|
||||
./services/restic.nix
|
||||
./specialization.nix
|
||||
./services/promtail.nix
|
||||
];
|
||||
services.openssh.enable = true;
|
||||
environment.systemPackages = with pkgs; [ git pinentry-curses ];
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
./services/minecraft.nix
|
||||
./services/nix-cache.nix
|
||||
./services/minio.nix
|
||||
./services/loki.nix
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ];
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{ ... }:
|
||||
{
|
||||
services.loki = {
|
||||
enable = true;
|
||||
configFile = ./loki.yaml;
|
||||
};
|
||||
systemd.services.promtail = {
|
||||
description = "Promtail service for Loki";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.grafana-loki}/bin/promtail --config.file ${./promtrail.yaml}
|
||||
'';
|
||||
};
|
||||
};
|
||||
networking.firewall.interfaces."wg0".allowedTCPPorts = [ 3100 ];
|
||||
}
|
||||
|
|
42
config/services/promtail.nix
Normal file
42
config/services/promtail.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let promtail_config = {
|
||||
server = {
|
||||
http_listen_port = 28183;
|
||||
grpc_listen_port = 0;
|
||||
};
|
||||
positions = {
|
||||
filename = "/tmp/positions.yaml";
|
||||
};
|
||||
client = {
|
||||
url = "http://[fd0d:a262:1fa6:e621:b4e1:08ff:e658:6f49]:3100/loki/api/v1/push";
|
||||
external_labels.host = config.networking.hostName;
|
||||
};
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "journal";
|
||||
journal = {
|
||||
max_age = "12h";
|
||||
labels.job = "systemd-journal";
|
||||
};
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = [ "__journal__systemd_unit" ];
|
||||
target_label = "unit";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
systemd.services.promtail = {
|
||||
description = "Promtail service for Loki";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.grafana-loki}/bin/promtail --config.file ${lib.generators.toYAML ./promtrail.yaml}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
server:
|
||||
http_listen_port: 28183
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
|
||||
clients:
|
||||
- url: http://[fd0d:a262:1fa6:e621:b4e1:08ff:e658:6f49]:3100/loki/api/v1/push
|
||||
external_labels:
|
||||
host: nixos-8gb-fsn1-1
|
||||
- url: http://[fd0d:a262:1fa6:e621:47e6:24d4:2acb:9437]:3100/loki/api/v1/push
|
||||
external_labels:
|
||||
host: nutty-noon
|
||||
|
||||
scrape_configs:
|
||||
- job_name: journal
|
||||
journal:
|
||||
max_age: 12h
|
||||
labels:
|
||||
job: systemd-journal
|
||||
relabel_configs:
|
||||
- source_labels: ["__journal__systemd_unit"]
|
||||
target_label: "unit"
|
Loading…
Reference in a new issue