add grafana loki promtail for monitoring

This commit is contained in:
2024-07-29 00:27:55 +05:30
parent ce75d3e6aa
commit f6ef05a057
4 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,40 @@
{...}: {
services = {
promtail = {
enable = true;
configuration = {
server = {
http_listen_port = 9080;
grpc_listen_port = 0;
};
positions = {
filename = "/var/lib/promtail/positions.yaml";
};
clients = [
{
url = "https://loki.0xtux.com/loki/api/v1/push";
}
];
scrape_configs = [
{
job_name = "journal";
journal = {
max_age = "12h";
labels = {
job = "systemd-journal";
};
};
relabel_configs = [
{
source_labels = [
"__journal__systemd_unit"
];
target_label = "unit";
}
];
}
];
};
};
};
}