initial observability setup
All checks were successful
Test action / Print hello world (push) Successful in 12s
All checks were successful
Test action / Print hello world (push) Successful in 12s
This commit is contained in:
parent
a3cb9796b1
commit
6511e513a3
7 changed files with 253 additions and 3 deletions
56
modules/nixos/services/observability/promtail/default.nix
Normal file
56
modules/nixos/services/observability/promtail/default.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ pkgs, config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
|
||||
cfg = config.${namespace}.services.observability.promtail;
|
||||
in
|
||||
{
|
||||
options.${namespace}.services.observability.promtail = {
|
||||
enable = mkEnableOption "enable Grafana Promtail";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.promtail = {
|
||||
enable = true;
|
||||
|
||||
# Ensures proper permissions
|
||||
extraFlags = [
|
||||
"-config.expand-env=true"
|
||||
];
|
||||
|
||||
configuration = {
|
||||
server = {
|
||||
http_listen_port = 9004;
|
||||
grpc_listen_port = 0;
|
||||
};
|
||||
|
||||
positions = {
|
||||
filename = "filename";
|
||||
};
|
||||
|
||||
clients = {
|
||||
url = "http://127.0.0.1:3100/loki/api/v1/push";
|
||||
};
|
||||
|
||||
scrape_configs = [
|
||||
{
|
||||
job_name = "journal";
|
||||
journal = {
|
||||
max_age = "12h";
|
||||
labels = {
|
||||
job = "systemd-journal";
|
||||
host = "ulmo";
|
||||
};
|
||||
};
|
||||
relabel_configs = [
|
||||
{ source_labels = [ "__journal__systemd_unit" ]; target_label = "unit"; }
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 9004 ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue