本文介绍了在Shiny Server中将Json记录到STDOUT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Docker容器配置为发送 stdout 中出现的所有内容,以发送到集中式日志记录服务。这是一个巧妙的技巧,如果您将适当的JSON打印到stdout,则可以使日志记录管道的大部分自动化,而不必担心文件。

Docker containers can be configured on AWS to send anything that appears in stdout to be sent to a centralized logging service. This is a neat trick, if you print appropriate JSON to stdout then you can automate large parts of your logging pipeline without having to worry about files.

我想在docker容器中与 shiny-server 一起使用。但是,将某些内容打印到 stdout 似乎很棘手。服务器自动将所有内容放置在日志文件中,这正是我不希望它执行的操作。 Shiny-server是否可以登录到stdout而不是文件?

I'd love to get this working with shiny-server in a docker container. But getting something printed to stdout seems rather tricky. The server automatically places everything in a logfile, which is exactly what I do not want it to do. Is it possible for shiny-server to log to stdout instead of a file?

推荐答案

遗憾的是,尚无法直接登录到stdout。但是,有一种方法可以监听文件系统的更改并正确打印日志。

Unfortunately there is no way to log into stdout directly yet. However there is an approach to listen to the filesystem changes and print the logs properly.

您可以使用例如 xtail (可作为debian软件包提供),并收听服务器日志文件夹的更改。例如,

You can use e.g. xtail (which is available as a debian package) and listen to the server log folder changes. E.g.

# start shiny server in detached mode
exec shiny-server 2>&1 &
 # push the "real" application logs to stdout with xtail
exec xtail /var/log/shiny-server/

我也将其准备为到摇摆器/发光的Docker映像。无论结果如何,您都可以在docker映像中使用它。

I also prepared this as a pull request to the rocker/shiny Docker image. Regardless of the result you can use it in your docker images.

这篇关于在Shiny Server中将Json记录到STDOUT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 05:42