From bd5ee9e7cd4863927340ab77cc84d7fb8ff8f41b Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 14 Oct 2021 17:06:39 +0200 Subject: [PATCH] nixos-module/defaults: add journalbeat for central logging --- nix/nixos-module/defaults.nix | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/nix/nixos-module/defaults.nix b/nix/nixos-module/defaults.nix index 601a4e3..a014e67 100644 --- a/nix/nixos-module/defaults.nix +++ b/nix/nixos-module/defaults.nix @@ -1,4 +1,4 @@ -{ hostName, inputs, pkgs, options, lib, ... }: +{ hostName, inputs, pkgs, config, options, lib, ... }: { boot.kernelParams = [ @@ -19,6 +19,32 @@ Storage=volatile ''; + # central logging + services.journalbeat = { + enable = true; + tags = [ "zentralwerk" ]; + extraConfig = '' + journalbeat.inputs: + # Paths that should be crawled and fetched. Possible values files and directories. + # When setting a directory, all journals under it are merged. + # When empty starts to read from local journal. + - paths: [] + journalbeat: + seek_position: cursor + cursor_seek_fallback: tail + write_cursor_state: true + cursor_flush_period: 5s + clean_field_names: true + convert_to_numbers: false + move_metadata_to_field: journal + default_type: journal + kernel: true + output.logstash: + # Boolean flag to enable or disable the output module. + enabled: true + hosts: ["${config.site.net.serv.logging.ip4}:5044"] + ''; + nix = { package = pkgs.nixFlakes; extraOptions = "experimental-features = nix-command flakes";