replace journald witrh loki+promtail
This commit is contained in:
parent
ded81c4cdd
commit
4da48d5f99
9 changed files with 110 additions and 142 deletions
43
modules/nixos/promtail/default.nix
Normal file
43
modules/nixos/promtail/default.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ config, constants, ... }:
|
||||
|
||||
{
|
||||
services.promtail = {
|
||||
enable = true;
|
||||
configuration = {
|
||||
server = {
|
||||
http_listen_port = 9080;
|
||||
grpc_listen_port = 0;
|
||||
};
|
||||
|
||||
clients = [
|
||||
{
|
||||
url = "http://${constants.hosts.sid.ip}:3100/loki/api/v1/push";
|
||||
}
|
||||
];
|
||||
|
||||
scrape_configs = [
|
||||
{
|
||||
job_name = "journal";
|
||||
journal = {
|
||||
max_age = "12h";
|
||||
path = "/var/log/journal";
|
||||
|
||||
labels = {
|
||||
job = "systemd-journal";
|
||||
host = config.networking.hostName;
|
||||
};
|
||||
};
|
||||
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = [ "__journal__systemd_unit" ];
|
||||
target_label = "unit";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
users.users.promtail.extraGroups = [ "systemd-journal" ];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue