Closed fabiokung closed 11 years ago
/cc @ryandotsmith
Thinking more about this, a new log-shuttle process (+ tcp connection + http request) for each log line is a bad idea. Closing this in favor of #20, which is a better way to support systems currently using logger
.
@fabiokung , I have circled back around to this issue, and found that your example seems to work on the latest version of log-shuttle.
$ log-shuttle --version
0.2
CMD='log-shuttle -logs-url="https://east.logplex.io/logs" -logplex-token="t.abc123"'
def log(message)
IO.popen(CMD, "w") { |io| io.puts(message) }
end
log('hello world')
@ryandotsmith thanks! I still don't think that this is a good idea, but it's good for simple testing and validation.
I'm trying to replace some uses of
logger
withlog-shuttle
. In this case, the code does something like:or:
log-shuttle
fails to replacelogger
in this case, with no useful error message. I noticed that it doesn't even send the http request to the logplex server.Playing with the code a little bit, I noticed that something like this makes it work:
Apparently log-shuttle needs some time to be ready to read stdin, and is probably being killed by a
SIGPIPE
(SIGCHLD
or something similar) before it gets a chance to read stdin and post the http message.I also tried
-batch-size=1
and lowwait
values, with no luck.