uyuni-project / uyuni-tools

Tools to work with containerized Uyuni server
Apache License 2.0
14 stars 18 forks source link

Add logs subcommand for mgrctl to better follow logs inside container #398

Open bjin01 opened 1 month ago

bjin01 commented 1 month ago

It would be great if a subcommand e.g. logs could be added so user can use mgrctl logs to directly monitor logs inside containers.

mgrctl logs --taskomatic -f
mgrctl logs --web -f
mgrctl logs --reposync -f
mgrctl logs --salt -f

-f should stand for "--follow" It is quite inconvenient to type out the long directory path inside container e.g.

mgrctl exec "tail -f /var/log/rhn/reposync/*.log"
mgrctl exec "tail -f /var/log/rhn/rhn_tasko*.log"
mgrctl exec "tail -f /var/log/rhn/rhn_web*.log"
mgrctl exec "tail -f /var/log/salt/{api,master,minion}"

THANKS

cbosdo commented 1 month ago

I wonder if we should have parameters for each log file or subcommands: mgrctl logs --taskomatic vs mgrctl logs taskomatic... The advantage of parameters is that this leaves the door opened to getting the logs of multiple files at a time. I don't know how easy to implement that would be though.

bjin01 commented 1 month ago

I think for taskomatic, salt and rhn_web* log files it is ok just to have a parameter:

mgrctl logs --taskomatic -f
mgrctl logs --web -f
mgrctl logs --salt -f

because the number of log files is quite low.

OK, we also have tomcat logs.

apache and postgres logs are pushed to journald.

But for reposync logs in /var/log/rhn/reposync/.log it would be good to let user specify a regex input. e.g. mgrctl logs --reposync --files "^opensuse." -f

I suppose the log directory paths are static or can be overriden by runtime env on the host.