我试图使用新的API的Heroku使用curl以流我的应用程序的日志: 这里是在DOC说(https://devcenter.heroku.com/articles/platform-api-reference#app)的Heroku应用程序日志流
Streaming is performed by doing an HTTP GET method on the provided logplex url and retrieving log lines utilizing chunked encoding.
首先,我检索在logplex网址:
curl -X POST https://api.heroku.com/apps/my-app/log-sessions \
-H "Accept: application/vnd.heroku+json; version=3" \
-H "Authorization:XXX" -v
然后我得到这样的回应:
"logplex_url":"https://logplex.heroku.com/sessions/abcdef-079b-4264-a83c-031feb31bfc2?srv=132456798"
所以我再拍卷曲电话:
curl -X GET "https://logplex.heroku.com/sessions/abcdef-8a7e-442f-a164-4c64e845b62d?srv=123456798" -H "Transfer-Encoding: chunked"
我有一个持久的连接,但没有一样是...
如果我不指定Transfer-Encoding头,我得到的日志,但连接关闭。
真的有可能流式传输日志,就像它在参考中指定的一样吗?
此外,根据您的使用情况,您可能会更好地使用日志排水渠。但我们还没有机会将这些添加到新的公共API中。你可以在这里看到如何使用它们:https://devcenter.heroku.com/articles/logging#syslog-drains – geemus