5

I use multitail to view 3 log files at the same time.

Let's say I notice something strange in the second log file.

How to scroll up the second log file, to look back at what had happened earlier?

Preferably without hiding the other two log files, because I want to keep an eye on them while investigating.

6

multitail has several interactive keys of which b will popup a menu asking you to choose which window to scroll. Use the arrow keys to navigate and press enter to select a window. That window will appear overlaying all the other windows, except for a small border of 2 characters in which you will be able to see any changes. You can scroll this chosen window with the arrow keys, and q to exit this mode. I don't know of any way to scroll whilst keeping the window arrangement intact.

Use F1 or h to get the popup help on the interactive keys available.


A hack you can do is run multitail inside tmux in a small pane, use b to create the scrolling subwindow, then make the pane full size. This does not change the size of the scrolling subwindow, but does make the logs visible in the new space. If you already have a tmux session with one window, then you can experiment from another terminal with the commands:

$ tmux split-window
$ tmux resize-pane -y 10
$ tmux send-keys 'multitail /var/log/maillog /var/log/messages /var/log/httpd/access_log' Enter
$ tmux send-keys Enter b Enter
$ tmux kill-pane -a -t. 

These send commands to the session to split the window, reduce the height of the active pane, and run a multitail that will say there is not really enough space. The second send-keys acknowledges this, and enters b for the scrolling subwindow. The final caommand kills the other pane and a full-size multitail is seen, with a small scrolling subwindow.

  • That's what I usually do, but unfortunately it makes it impossible to keep an eye on the other two log files. The first log file only gets 2 lines shown, and the third only 1 line. It is practically impossible to keep an eye on a log file with only 1 line :-/ – Nicolas Raoul Apr 20 '17 at 4:05
  • One hack you can try is to first reduce the height of the terminal multitail is running in, use b to create the scrolling subwindow, then increase the height back to what it was. This does not change the size of the subwindow, but does make the logs visible in the new space. Running multitail inside tmux, for example, would be similar and make it possible to script the sequence of events. – meuh Apr 20 '17 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.