We are currently running a command on a Linux box that we have little control over. The command tails a log file, piping the results to an outbound SSH connection to our server, redirecting the output to a file.
The command we use to do this is:
sh -c tail -f /var/log/x/a.log | ssh [email protected] -T 'cat - > /media/z/logs/a.log'
We are then able to perform additional processing of the captured log segment.
However, we now need the ability to forward the streaming output of an additional log file using the same ssh connection.
Doing
sh -c tail -f /var/log/x/a.log /var/log/x/b.log | ssh [email protected] -T 'cat - > /media/z/logs/a.log'
works, but it combines the two log files into one (with a header appearing before each line saying which file it came from).
We need the output to bee two different files but are limited to a single outbound SSH connection from the log server to our server. We do not have sudo or admin rights on the log server and are not able to get any software that would require it installed. If it matters, the remote log server is running CentOS and our server is running Ubuntu.
Is there a way to split the output into two files? Or some other method of running multiple commands in parallel over the reverse SSH connection?