mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-19 07:59:24 +03:00
Merge pull request #22066 from mbrgm/journalbeat
journalbeat service: init at 5.1.2
This commit is contained in:
commit
ae4f2fd145
5 changed files with 114 additions and 0 deletions
|
@ -290,6 +290,7 @@
|
||||||
mbbx6spp = "Susan Potter <me@susanpotter.net>";
|
mbbx6spp = "Susan Potter <me@susanpotter.net>";
|
||||||
mbe = "Brandon Edens <brandonedens@gmail.com>";
|
mbe = "Brandon Edens <brandonedens@gmail.com>";
|
||||||
mboes = "Mathieu Boespflug <mboes@tweag.net>";
|
mboes = "Mathieu Boespflug <mboes@tweag.net>";
|
||||||
|
mbrgm = "Marius Bergmann <marius@yeai.de>";
|
||||||
mcmtroffaes = "Matthias C. M. Troffaes <matthias.troffaes@gmail.com>";
|
mcmtroffaes = "Matthias C. M. Troffaes <matthias.troffaes@gmail.com>";
|
||||||
mdaiter = "Matthew S. Daiter <mdaiter8121@gmail.com>";
|
mdaiter = "Matthew S. Daiter <mdaiter8121@gmail.com>";
|
||||||
meditans = "Carlo Nucera <meditans@gmail.com>";
|
meditans = "Carlo Nucera <meditans@gmail.com>";
|
||||||
|
|
|
@ -212,6 +212,7 @@
|
||||||
./services/logging/awstats.nix
|
./services/logging/awstats.nix
|
||||||
./services/logging/fluentd.nix
|
./services/logging/fluentd.nix
|
||||||
./services/logging/graylog.nix
|
./services/logging/graylog.nix
|
||||||
|
./services/logging/journalbeat.nix
|
||||||
./services/logging/klogd.nix
|
./services/logging/klogd.nix
|
||||||
./services/logging/logcheck.nix
|
./services/logging/logcheck.nix
|
||||||
./services/logging/logrotate.nix
|
./services/logging/logrotate.nix
|
||||||
|
|
76
nixos/modules/services/logging/journalbeat.nix
Normal file
76
nixos/modules/services/logging/journalbeat.nix
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.journalbeat;
|
||||||
|
|
||||||
|
journalbeatYml = pkgs.writeText "journalbeat.yml" ''
|
||||||
|
name: ${cfg.name}
|
||||||
|
tags: ${builtins.toJSON cfg.tags}
|
||||||
|
|
||||||
|
journalbeat.cursor_state_file: ${cfg.stateDir}/cursor-state
|
||||||
|
|
||||||
|
${cfg.extraConfig}
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.journalbeat = {
|
||||||
|
|
||||||
|
enable = mkEnableOption "journalbeat";
|
||||||
|
|
||||||
|
name = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "journalbeat";
|
||||||
|
description = "Name of the beat";
|
||||||
|
};
|
||||||
|
|
||||||
|
tags = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
description = "Tags to place on the shipped log messages";
|
||||||
|
};
|
||||||
|
|
||||||
|
stateDir = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "/var/lib/journalbeat";
|
||||||
|
description = "The state directory. Journalbeat's own logs and other data are stored here.";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = ''
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
description = "Any other configuration options you want to add";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
systemd.services.journalbeat = with pkgs; {
|
||||||
|
description = "Journalbeat log shipper";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
preStart = ''
|
||||||
|
mkdir -p ${cfg.stateDir}/data
|
||||||
|
mkdir -p ${cfg.stateDir}/logs
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.journalbeat}/bin/journalbeat -c ${journalbeatYml} -path.data ${cfg.stateDir}/data -path.logs ${cfg.stateDir}/logs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
34
pkgs/tools/system/journalbeat/default.nix
Normal file
34
pkgs/tools/system/journalbeat/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{ lib, pkgs, buildGoPackage, fetchFromGitHub, makeWrapper }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
libPath = lib.makeLibraryPath [ pkgs.systemd.lib ];
|
||||||
|
|
||||||
|
in buildGoPackage rec {
|
||||||
|
|
||||||
|
name = "journalbeat-${version}";
|
||||||
|
version = "5.1.2";
|
||||||
|
|
||||||
|
goPackagePath = "github.com/mheese/journalbeat";
|
||||||
|
|
||||||
|
buildInputs = [ makeWrapper pkgs.systemd ];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
wrapProgram $bin/bin/journalbeat \
|
||||||
|
--prefix LD_LIBRARY_PATH : ${libPath}
|
||||||
|
'';
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "mheese";
|
||||||
|
repo = "journalbeat";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "179jayzvd5k4mwhn73yflbzl5md1fmv7a9hb8vz2ir76lvr33g3l";
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = https://github.com/mheese/journalbeat;
|
||||||
|
description = "Journalbeat is a log shipper from systemd/journald to Logstash/Elasticsearch";
|
||||||
|
license = licenses.asl20;
|
||||||
|
maintainers = with maintainers; [ mbrgm ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -2361,6 +2361,8 @@ in
|
||||||
gcc = gcc49; # doesn't build with gcc5
|
gcc = gcc49; # doesn't build with gcc5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
journalbeat = callPackage ../tools/system/journalbeat { };
|
||||||
|
|
||||||
jp = callPackage ../development/tools/jp { };
|
jp = callPackage ../development/tools/jp { };
|
||||||
|
|
||||||
jp2a = callPackage ../applications/misc/jp2a { };
|
jp2a = callPackage ../applications/misc/jp2a { };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue