nixos/osquery: set default database_path and logger_path

Changed files
+22 -8
nixos
modules
services
monitoring
+22 -8
nixos/modules/services/monitoring/osquery.nix
···
freeformType = attrsOf str;
options = {
database_path = lib.mkOption {
-
default = "osquery/osquery.db";
readOnly = true;
-
description = "Path used for the database file, relative to /var/lib/.";
-
type = nonEmptyStr;
};
logger_path = lib.mkOption {
-
default = "osquery";
readOnly = true;
-
description = "Base directory used for logging, relative to /var/log/.";
-
type = nonEmptyStr;
};
pidfile = lib.mkOption {
default = "/run/osquery/osqueryd.pid";
···
serviceConfig = {
ExecStart = "${pkgs.osquery}/bin/osqueryd --flagfile ${flagfile}";
PIDFile = cfg.flags.pidfile;
-
LogsDirectory = cfg.flags.logger_path;
-
StateDirectory = dirname cfg.flags.database_path;
Restart = "always";
};
wantedBy = [ "multi-user.target" ];
···
freeformType = attrsOf str;
options = {
database_path = lib.mkOption {
+
default = "/var/lib/osquery/osquery.db";
readOnly = true;
+
description = ''
+
Path used for the database file.
+
+
::: {.note}
+
If left as the default value, this directory will be automatically created before the
+
service starts, otherwise you are responsible for ensuring the directory exists with
+
the appropriate ownership and permissions.
+
'';
+
type = path;
};
logger_path = lib.mkOption {
+
default = "/var/log/osquery";
readOnly = true;
+
description = ''
+
Base directory used for logging.
+
+
::: {.note}
+
If left as the default value, this directory will be automatically created before the
+
service starts, otherwise you are responsible for ensuring the directory exists with
+
the appropriate ownership and permissions.
+
'';
+
type = path;
};
pidfile = lib.mkOption {
default = "/run/osquery/osqueryd.pid";
···
serviceConfig = {
ExecStart = "${pkgs.osquery}/bin/osqueryd --flagfile ${flagfile}";
PIDFile = cfg.flags.pidfile;
+
LogsDirectory = lib.mkIf (cfg.flags.logger_path == "/var/log/osquery") [ "osquery" ];
+
StateDirectory = lib.mkIf (cfg.flags.database_path == "/var/lib/osquery/osquery.db") [ "osquery" ];
Restart = "always";
};
wantedBy = [ "multi-user.target" ];