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:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user