8

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"
Ian
  • 1,488
  • 4
  • 26
  • 32

2 Answers2

10

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.

Insyte
  • 9,314
  • 2
  • 27
  • 45
  • 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: http://www.sshkeychain.org/mirrors/SSH-with-Keys-HOWTO/ – Insyte Aug 14 '09 at 06: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
1

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.

Jack M.
  • 793
  • 3
  • 12
  • 21
  • 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