Tailing multiple logs with tmux

by Álex 2014-03-15 devops tail tmux

I had a system that was creating a different log for each worker. Those logs where in the form: /var/log/baselog, /var/log/baselog.1, /var/log/baselog.2 and so on. I wanted to tail them but they were being updated simultaneously so the output of the tail was being a mess.

I am a tmux user since few months ago (if you aren’t, you should!) so I’ve decide to open all of them in different tmux panes. Thanks to having a pane for every log what we will achieve is the ability to scroll just one of them, maximize it in case that we need it, move to a new window, save the buffer…

How can you achieve that? Quite simple, just download this script to some place:

Once you have saved it installed, run it with the base log file:

sh tail_several_logs.sh /var/log/baselog

The script have some limitations easily fixable:

Feel free of do whatever you want with the script. I just hope that it’s useful for somebody else.


comments powered by Disqus

polo is made with by @agonzalezro