liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6478c56ed1db0321cb9bc89872b24d975296c640
parent 186543d2de26167d92dcedfe74d029d56be3ce94
Author: Daniel Barlow <dan@telent.net>
Date:   Sat, 25 Oct 2025 17:34:50 +0100

log.shipping.command is now a command not a string

Diffstat:
Mmodules/s6/default.nix | 11+++++------
Mpkgs/logshippers/victorialogsend.fnl | 6+++---
2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/modules/s6/default.nix b/modules/s6/default.nix @@ -239,10 +239,12 @@ in shipping = { enable = mkEnableOption "fifo for log shipping"; command = mkOption { - description = "log shipping command, should open the file named by the environment variable $LOG_FIFO"; - type = types.lines; + description = "log shipping command, should accept one parmeter which is the file name to read"; + type = types.pathInStore; example = lib.literalExpression '' + writeAshScript "shipper" {} \'\' ''${pkgs.s6-networking}/bin/s6-tcpclient loghost 9428 ''${pkgs.logshippers}/bin/victorialogsend http://loghost:9428/insert/jsonline + \'\' ''; }; dependencies = mkOption { @@ -270,10 +272,7 @@ in mkIf config.logging.shipping.enable ( longrun { name = "log-shipper"; - run = '' - export LOG_FIFO=${fifo} - ${cfg.command} - ''; + run = "${cfg.command} ${fifo}"; inherit (config.logging.shipping) dependencies; } ); diff --git a/pkgs/logshippers/victorialogsend.fnl b/pkgs/logshippers/victorialogsend.fnl @@ -29,7 +29,7 @@ ["--basic-auth" auth & rest] (assoc (parse-args rest) :auth auth) - [url] { :url (parse-url url) } + [fifo url] { :fifo fifo :url (parse-url url) } _ (error "invalid args"))) @@ -87,11 +87,11 @@ Host: %s\ true) (fn run [] - (let [{ : auth : url } (parse-args arg) + (let [{ : auth : url : fifo } (parse-args arg) http-response-fd 6 http-req-fd 7] (writefd http-req-fd (http-header url.host url.path auth)) - (with-open [logs (assert (io.open (os.getenv "LOG_FIFO") :r))] + (with-open [logs (assert (io.open fifo :r))] (while (case (logs:read "l") line (writefd http-req-fd (process-line line))))) (writefd http-req-fd (chunk ""))