title: Run SSH session and log to a file stdout from client adding timestamp
body: <p>I need to collect debug traces from a SSH connection. I would like to run SSH client from a linux terminal, inside a screen session, being able to interact with the session to start traces and then have all the output logged to a file, but I also would like to add a timestamp in front of each line including the millisecond information.</p>
  
  <p>I tried to use:</p>
  
  <p><code>ssh ... | awk '{ print strftime("%a\ %b\ %d\ %H:%M:%S.%N\ %Y"), $0; fflush(); }' | tee logfile</code></p>
  
  <p>it works but it has two problems: no milliseconds, because %N is not supported in strftime and the commands input from terminal are not visible until I send them.</p>
  
  <p>Please consider that I probably cannot install linux packages (I am running this form a Qnap NAS) and I am not a master in linux environment</p>
  
  <p>Many thanks</p>