blob: 73a8de2bc2f78696e135d2321c394fef025c5afa (
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
|
{
config,
lib,
...
}: let
cfg = config.getchoo.server.services.promtail;
inherit (lib) mkEnableOption mkIf mkOption types;
in {
options.getchoo.server.services.promtail = {
enable = mkEnableOption "enable promtail";
port = mkOption {
type = types.port;
default = 3031;
description = "port for promtail";
};
clients = mkOption {
type = types.listOf types.attrs;
default = [{}];
description = "clients for promtail";
};
};
config.services.promtail = mkIf cfg.enable {
enable = true;
configuration = {
server = {
http_listen_port = cfg.port;
grpc_listen_port = 0;
};
positions = {
filename = "/tmp/positions.yaml";
};
inherit (cfg) clients;
scrape_configs = [
{
job_name = "journal";
journal = {
max_age = "12h";
labels = {
job = "systemd-journal";
host = "${config.networking.hostName}";
};
};
relabel_configs = [
{
source_labels = ["__journal__systemd_unit"];
target_label = "unit";
}
];
}
];
};
};
}
|