3

I want to use multitail over ssh. But following command fails:

$ multitail "ssh dev-04 tail -f /opt/app/app.log"
Error opening file ssh docdev-04 tail -f /opt/alfresco/share.log (No such file or directory)

However just ssh with tail works fine and displays the content of the file:

$ ssh dev-04 tail -f /opt/app/app.log            
Enter passphrase for key '/home/username/.ssh/id_rsa': 
2016-08-03 09:40:27,926 INFO  [org.springframework.extensions.webscripts.DeclarativeRegistry] [localhost-startStop-1] Registered 8 Package Description Documents (+0 failed)

I would guess that the problem is in the password request. But anyway I don't know how to make it work

1 Answer 1

4

According to the manpage of multitail you need the -l flag:

-l command Command to execute in a window. Parameter is the command. Do not forget to use "'s if the external command needs parameter! (e.g. -l "ping host").

So, in your case, try: multitail -l "ssh dev-04 tail -f /opt/app/app.log"

In your current form, multitail expects the argument "ssh dev-04 tail -f /opt/app/app.log" to be a file, not an application to execute and capture.

I don't know how well the password input would work, but if that also fails, try ssh authentication by keys. (see, for instance: https://wiki.archlinux.org/index.php/SSH_keys)

4
  • 2
    Or more particularly the section on ssh-agent since the OP's screen copy-paste indicates he is already using SSH keys, just without ssh-agent. Aug 10, 2016 at 13:45
  • My bad - should read documentation, I thought -l is used if there is more that one window. Actually with -l and ssh-agent it works perfectly! Thanks @madeddie and @user4556274! Aug 10, 2016 at 13:49
  • How could I run sudo before tailing the file? Oct 30, 2019 at 13:17
  • Do you mean run tail with sudo? Using the example above it would simply be multitail -l "ssh dev-04 sudo tail -f /opt/app/app.log". Mind you this would need sudo privileges with NOPASSWD
    – madeddie
    Nov 6, 2019 at 1:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .