Compare commits

..

4 commits

Author SHA1 Message Date
Théo Barnouin
3fd9c73fc1 Update flake
Some checks are pending
/ Build Nix targets (push) Waiting to run
2025-05-13 14:16:14 +02:00
Théo Barnouin
0511396ca7 Improve rsyslog config 2025-05-13 14:15:43 +02:00
Théo Barnouin
54ec8c85d3 Improve Loki config 2025-05-13 13:50:26 +02:00
Théo Barnouin
fa7852d5a5 Send logs to promtail directly (not rsyslog) 2025-05-13 13:50:05 +02:00
5 changed files with 44 additions and 77 deletions

18
flake.lock generated
View file

@ -9,11 +9,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1741508717, "lastModified": 1744897914,
"narHash": "sha256-iQf1WdNxaApOFHIx4RLMRZ4f8g+8Xp0Z1/E/Mz2rLxY=", "narHash": "sha256-GIVU92o2TZBnKQXTb76zpQbWR4zjU2rFqWKNIIpXnqA=",
"owner": "yaxitech", "owner": "yaxitech",
"repo": "ragenix", "repo": "ragenix",
"rev": "2a2bea99d74927e54adf53cbf113219def67d5c9", "rev": "40f2e17ecaeab4d78ec323e96a04548c0aaa5223",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -169,11 +169,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1744117652, "lastModified": 1747020534,
"narHash": "sha256-t7dFCDl4vIOOUMhEZnJF15aAzkpaup9x4ZRGToDFYWI=", "narHash": "sha256-D/6rkiC6w2p+4SwRiVKrWIeYzun8FBg7NlMKMwQMxO0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "b4e98224ad1336751a2ac7493967a4c9f6d9cb3f", "rev": "b4bbdc6fde16fc2051fcde232f6e288cd22007ca",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -201,11 +201,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1744309437, "lastModified": 1746957726,
"narHash": "sha256-QZnNHM823am8apCqKSPdtnzPGTy2ZB4zIXOVoBp5+W0=", "narHash": "sha256-k9ut1LSfHCr0AW82ttEQzXVCqmyWVA5+SHJkS5ID/Jo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f9ebe33a928b5d529c895202263a5ce46bdf12f7", "rev": "a39ed32a651fdee6842ec930761e31d1f242cb94",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -55,20 +55,6 @@ in {
]; ];
}; };
}; };
rsyslogd = {
enable = true;
extraConfig = ''
ruleset(name="remote"){
action(type="omfwd" Target="localhost" Port="1514" Protocol="tcp" Template="RSYSLOG_SyslogProtocol23Format" TCP_Framing="octet-counted")
}
module(load="imudp")
input(type="imudp" port="514" ruleset="remote")
module(load="imtcp")
input(type="imtcp" port="514" ruleset="remote")
'';
};
influxdb2 = { influxdb2 = {
enable = true; enable = true;
}; };
@ -270,59 +256,20 @@ in {
loki = { loki = {
enable = true; enable = true;
configuration = { configuration = {
server.http_listen_port = 3100;
server.grpc_listen_port = 9096;
auth_enabled = false; auth_enabled = false;
ingester = { server = {
lifecycler = { http_listen_port = 3100;
address = "192.168.1.27"; grpc_listen_port = 9096;
ring = { };
kvstore = { common = {
store = "inmemory"; instance_addr = "0.0.0.0";
path_prefix = "/tmp/loki";
storage.filesystem = {
chunks_directory = "/tmp/loki/chunks";
rules_directory = "/tmp/loki/rules";
}; };
replication_factor = 1; replication_factor = 1;
}; ring.kvstore.store = "inmemory";
};
chunk_idle_period = "1h";
max_chunk_age = "1h";
chunk_target_size = 999999;
chunk_retain_period = "30s";
};
schema_config = {
configs = [
{
from = "2022-06-06";
store = "boltdb-shipper";
object_store = "filesystem";
schema = "v13";
index = {
prefix = "index_";
period = "24h";
};
}
];
};
storage_config = {
boltdb_shipper = {
active_index_directory = "/var/lib/loki/boltdb-shipper-active";
cache_location = "/var/lib/loki/boltdb-shipper-cache";
cache_ttl = "24h";
};
filesystem = {
directory = "/var/lib/loki/chunks";
};
};
limits_config = {
reject_old_samples = true;
reject_old_samples_max_age = "168h";
allow_structured_metadata = false;
};
table_manager = {
retention_deletes_enabled = false;
retention_period = "0s";
}; };
compactor = { compactor = {
working_directory = "/var/lib/loki"; working_directory = "/var/lib/loki";
@ -332,6 +279,24 @@ in {
}; };
}; };
}; };
query_range.results_cache.cache.embedded_cache = {
enabled = true;
max_size_mb = 100;
};
schema_config.configs = [
{
from = "2025-05-13";
store = "tsdb";
object_store = "filesystem";
schema = "v13";
index = {
prefix = "index_";
period = "24h";
};
}
];
ruler.alertmanager_url = "http://localhost:9093";
analytics.reporting_enabled = false;
}; };
}; };
promtail = { promtail = {

View file

@ -128,7 +128,9 @@
}; };
rsyslogd = { rsyslogd = {
enable = true; enable = true;
extraConfig = "*.*@192.168.1.27:514;RSYSLOG_SyslogProtocol23Format"; extraConfig = ''
*.* action(type="omfwd" target="192.168.1.27" port="1514" protocol="tcp")
'';
}; };
prometheus = { prometheus = {
exporters = { exporters = {

View file

@ -181,7 +181,7 @@ in {
}; };
rsyslogd = { rsyslogd = {
enable = true; enable = true;
extraConfig = "*.*@192.168.1.27:514;RSYSLOG_SyslogProtocol23Format"; extraConfig = "*.*@192.168.1.27:1514;RSYSLOG_SyslogProtocol23Format";
}; };
prometheus = { prometheus = {
exporters = { exporters = {

View file

@ -115,7 +115,7 @@
}; };
rsyslogd = { rsyslogd = {
enable = true; enable = true;
extraConfig = "*.*@192.168.1.27:514;RSYSLOG_SyslogProtocol23Format"; extraConfig = "*.*@192.168.1.27:1514;RSYSLOG_SyslogProtocol23Format";
}; };
prometheus = { prometheus = {
exporters = { exporters = {