From 691932bba67591a23aa4ad1e844a4cbf4d16eff5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Braun Date: Wed, 5 Dec 2018 14:56:23 +0100 Subject: cassandra: add option to configure logging As cassandra start script hardcodes the location of logback configuration to `CASSANDRA_CONF_DIR/logback.xml` there is no way to pass an alternate file via `$JVM_OPTS` for example. Also, without logback configuration DEBUG level is used which is not necessary for standard usage. With this commit a default logback configuration is set with log level INFO. Configuration borrowed from: https://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/configLoggingLevels.html --- nixos/modules/services/databases/cassandra.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'nixos/modules') diff --git a/nixos/modules/services/databases/cassandra.nix b/nixos/modules/services/databases/cassandra.nix index 86e74d5d5ab42..d741ee48c48f0 100644 --- a/nixos/modules/services/databases/cassandra.nix +++ b/nixos/modules/services/databases/cassandra.nix @@ -34,11 +34,13 @@ let { name = "cassandra-etc"; cassandraYaml = builtins.toJSON cassandraConfigWithAddresses; cassandraEnvPkg = "${cfg.package}/conf/cassandra-env.sh"; + cassandraLogbackConfig = pkgs.writeText "logback.xml" cfg.logbackConfig; buildCommand = '' mkdir -p "$out" echo "$cassandraYaml" > "$out/cassandra.yaml" ln -s "$cassandraEnvPkg" "$out/cassandra-env.sh" + ln -s "$cassandraLogbackConfig" "$out/logback.xml" ''; }; in { @@ -139,7 +141,27 @@ in { correspond to a single address, IP aliasing is not supported. ''; }; + logbackConfig = mkOption { + type = types.lines; + default = '' + + + + %-5level %date{HH:mm:ss,SSS} %msg%n + + + + + + + + + ''; + description = '' + XML logback configuration for cassandra + ''; + }; extraConfig = mkOption { type = types.attrs; default = {}; -- cgit 1.4.1