Merging against master - updating smokingpig, rebase was going to be messy

This commit is contained in:
Parnell Springmeyer
2017-01-26 02:00:04 -08:00
956 changed files with 25853 additions and 24254 deletions
@@ -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";
};
};
};
}
+7 -7
View File
@@ -63,7 +63,7 @@ in
description = "Enable the logstash web interface.";
};
address = mkOption {
listenAddress = mkOption {
type = types.str;
default = "0.0.0.0";
description = "Address on which to start webserver.";
@@ -77,7 +77,7 @@ in
inputConfig = mkOption {
type = types.lines;
default = ''stdin { type => "example" }'';
default = ''generator { }'';
description = "Logstash input configuration.";
example = ''
# Read from journal
@@ -90,7 +90,7 @@ in
filterConfig = mkOption {
type = types.lines;
default = ''noop {}'';
default = "";
description = "logstash filter configuration.";
example = ''
if [type] == "syslog" {
@@ -108,11 +108,11 @@ in
outputConfig = mkOption {
type = types.lines;
default = ''stdout { debug => true debug_format => "json"}'';
default = ''stdout { codec => rubydebug }'';
description = "Logstash output configuration.";
example = ''
redis { host => "localhost" data_type => "list" key => "logstash" codec => json }
elasticsearch { embedded => true }
redis { host => ["localhost"] data_type => "list" key => "logstash" codec => json }
elasticsearch { }
'';
};
@@ -147,7 +147,7 @@ in
${cfg.outputConfig}
}
''} " +
ops cfg.enableWeb "-- web -a ${cfg.address} -p ${cfg.port}";
ops cfg.enableWeb "-- web -a ${cfg.listenAddress} -p ${cfg.port}";
};
};
};