mediasoup logging


We run mediasoup in a docker as an ECS task in AWS. We have a centralized logstash that we send all our logs to. We need to be able to grab the mediasoup console logs and send it to logstash but there is no way to get those in the library.
Has anyone done something like that before?


Why do you say there is no way to get logs?: mediasoup :: API

Yeah, I am able to set up the logging and it generates the logs fine, on the server. The issue is that it writes all the logs to console. I want to be able to grab those (some kind of handler) and send it to logstash for debugging purposes specially in production environment. The docker shuts down when the webrtc recording ends so we have no way to get the logs if there is a failure.

Normally in containerized apps all output is written to stdout/stderr and application itself works with read-only filesystem. Container logs are stored in special location in the filesystem in JSON files (in case Docker is used and container runtime) and usually log collecting tools are capable to read it on the fly as container runs. This is especially true for k8s setups where having containers that write to file system (unless it is a database container) is a bad practice and often leads to issues.

Clusters I worked with used Promtail and DataDog for that, there might be corresponding Logstash integration as well.

If you’re unable to do that for whatever reason (please strongly consider to though) you can use app | log-collector in shell and pipe logs to whatever app you like for further processing.