send logs from servers to loki
This commit is contained in:
parent
ec7007844e
commit
f55583a23e
5 changed files with 46 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
{lib, ...}: {
|
||||
imports = [
|
||||
../cli.nix
|
||||
../send-logs.nix
|
||||
./bolty-boot.nix
|
||||
./gitea-runner.nix
|
||||
./home-assistant.nix
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
...
|
||||
}: let
|
||||
lokiPort = 3030;
|
||||
promtailPort = 3031;
|
||||
path = "/data/loki";
|
||||
in {
|
||||
services.loki = {
|
||||
enable = true;
|
||||
configuration = {
|
||||
server.http_listen_address = "bolty.raptor-carp.ts.net";
|
||||
server.http_listen_address = "0.0.0.0";
|
||||
server.http_listen_port = lokiPort;
|
||||
auth_enabled = false;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
imports = [
|
||||
"${inputs.nixpkgs-stable}/nixos/modules/profiles/qemu-guest.nix"
|
||||
../cli.nix
|
||||
../send-logs.nix
|
||||
./atuin.nix
|
||||
./boot.nix
|
||||
./disks.nix
|
||||
|
|
41
nixos/boxes/send-logs.nix
Normal file
41
nixos/boxes/send-logs.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
services.promtail = {
|
||||
enable = true;
|
||||
configuration = {
|
||||
server = {
|
||||
http_listen_port = 3031;
|
||||
grpc_listen_port = 0;
|
||||
};
|
||||
positions = {
|
||||
filename = "/tmp/positions.yaml";
|
||||
};
|
||||
clients = [
|
||||
{
|
||||
url = "http://bolty.raptor-carp.ts.net:3030/loki/api/v1/push";
|
||||
}
|
||||
];
|
||||
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";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,6 +5,7 @@
|
|||
./vpsfree1-vpsadminos.nix
|
||||
../cli.nix
|
||||
../nginx.nix
|
||||
../send-logs.nix
|
||||
./backups.nix
|
||||
./cryptpad.nix
|
||||
./foundryvtt.nix
|
||||
|
|
Loading…
Reference in a new issue