2
0

change log shipper interface

* it's now a command not a service
* shipper is expected to open() the fifo passed as $LOG_FIFO instead of
  getting logs on stdin

logtap determines that remote logs are getting sent when there's a
reader on the fifo it's writing, but opening the fifo as stdin of
s6-tcpclient is too early as it hasn't even connected to the remote
log server at that time
This commit is contained in:
2025-10-09 21:31:07 +01:00
parent b49beb2c86
commit a6442c872f
3 changed files with 55 additions and 35 deletions

View File

@@ -88,13 +88,14 @@ Host: %s\
(fn run []
(let [{ : auth : url } (parse-args arg)
in-fd 6
out-fd 7]
(writefd out-fd (http-header url.host url.path auth))
(while (case (io.stdin:read "l")
line (writefd out-fd (process-line line))))
(writefd out-fd (chunk ""))
(io.stderr:write (ll.read in-fd))))
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))]
(while (case (logs:read "l")
line (writefd http-req-fd (process-line line)))))
(writefd http-req-fd (chunk ""))
(io.stderr:write (ll.read http-response-fd))))
{ : run }