Logging Json to STDOUT in Shiny Server

2020-07-18 10:29发布

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.

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?

标签: r docker shiny
1条回答
Bombasti
2楼-- · 2020-07-18 11:06

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.

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/

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.

查看更多
登录 后发表回答