Use local tools to monitor remote logs

5,637

Solution 1

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.

Solution 2

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.

Share:
5,637

Related videos on Youtube

Ian
Author by

Ian

Updated on September 17, 2022

Comments

  • Ian
    Ian almost 2 years

    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
    Ian almost 15 years
    I'm a noob. Can you give me a little more detail about how I would do this? :)
  • Ian
    Ian almost 15 years
    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?
  • Return_Of_The_Archons
    Return_Of_The_Archons almost 15 years
    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
  • Jack M.
    Jack M. almost 15 years
    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 ...
  • Ian
    Ian almost 15 years
    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
    Ian almost 15 years
    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"