I don't have root access on my hosted web server, but I would like to use tools like MultiTail to monitor log files that are generated on my web host.

Is there a way I can pipe the log output on my remote host ( I have ssh access ), to my locally running MultiTail?

The local machine is running Ubuntu 9.04. The remote machine is running FreeBSD 6.


The answer in a nut-shell:

1) Set up key-based login for ssh.

2) Execute the following command:

multitail -l "ssh -l USER HOST tail -f ./www_logs/access_log" -l "ssh -l USER2 HOST2 tail -f ./www_logs/access_log"

You could try something like this:

multitail -l "ssh remotehost tail -f /var/log/messages" \
          -l "ssh remotehost tail -f /var/log/mail.log"

I'm sure there are lots of nice multitail options I'm missing, but that should at least get the basics working.

  • multitail exits because ssh requests my login password. is there a way to pass the password through? or do i need to set up those ssh certs that allow password-less login? – Ian Aug 13 '09 at 22:52
  • The key-based logins are the way to go. There are a ton of good HOWTOs for setting that up. This one looks pretty thorough: sshkeychain.org/mirrors/SSH-with-Keys-HOWTO – Insyte Aug 14 '09 at 6:33
  • i got the key-based login working, but the ssh remotehost tail -f /logfile command doesn't seem to work. is there a special syntax required by ssh to pass it a command to execute after log in? – Ian Aug 14 '09 at 19:51
  • Aha, got it.. Here's the full command to get it working after setting up the key-based login: multitail -l "ssh -l USER HOST tail -f ./www_logs/access_log" -l "ssh -l USER2 HOST2 tail -f ./www_logs/access_log" – Ian Aug 14 '09 at 19:55

If you have access to compilers on the remote box, just compile multitail up there, and install it in your user's directory.

./configure --prefix=~/bin/

Should work fine as long as ncurses is installed.

  • I'm a noob. Can you give me a little more detail about how I would do this? :) – Ian Aug 13 '09 at 22:46
  • Follow the same steps you did to compile it on your local machine. But when you run ./configure, simply add --prefix=~/bin/ to it. Then when you go to run the command, use ~/bin/multitail file1.txt file2.txt ... – Jack M. Aug 14 '09 at 16:09

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.