DarthSim / overmind

Process manager for Procfile-based applications and tmux
MIT License
2.82k stars 79 forks source link

Allow viewing logs for specific processes #111

Open adibsaad opened 3 years ago

adibsaad commented 3 years ago

Add an option to specify which process to view logs for e.g.

overmind echo web

Also, would be nice to have logs be an alias for echo.

DarthSim commented 3 years ago

Hey Adib!

echo is only meant for streaming the daemonized process output to stdout. It doesn't have history and stuff. connect is more suitable for viewing the logs.

gerardnico commented 2 months ago

Hy Adib and Darth!

Quick question on how to subscribe to the overmind logs (came here while searching for a overmind logs command)

I'm restarting a process inside a docker container with overmind restart and I want to show the stdout of this process until I read a certain line.

Is there a way to subscribe to it via overmind ?

Thanks

Ps:

Any pointer welcome. Have a nice day Nico

DarthSim commented 2 months ago

Hey @gerardnico! Unfortunately, Overmind doesn't have such a feature.

There's an ugly workaround (replace process_name with the actual process name):

overmind echo | grep --line-buffered -E '^([[:cntrl:]]\[\d+(;\d+)*m)?process_name\s*([[:cntrl:]]\[0m)? \| ' | sed 's/^.*\| //'

grep selects only the lines for the required process. All that ugly stuff around the process name is to match the coloring.

sed removes the process name from the lines.

gerardnico commented 2 months ago

Thanks @DarthSim Daemon mode then.

You still capture the stdout of the terminals because I get them in the docker logs with different colour. How do you do that. This is a feature of tmux?

Actually in other setups, I get the logs file of running process and redirect them to '/dev/fd/1' so that they show up in the docker logs command.

Thanks ! Pretty impressive. I'm a dummy with tty and overmind feels magical.