I have a similar requirement except I need to be able to "turn on" the output to local pipe/process after logging in and setting things up. I don't want all the login text getting put into the local file/pipe.
Basically, I need to ngrep from a remote machine, and pipe the output to a local test script that checks the network traffic for certain things. Also, when the test is running, I don't want to mix outputs which would happen if I used tee. I'd see the output from the ngrep, PLUS the output from the test which would be confusing. Also, directly redirecting to a file > filename would mean the login process would all be redirected to the file and I wouldn't be able to see what was going on.
This is for a demo so it has to be clear to the audience what is going on.
ssh yo@remote_box.
sudo ngrep | local_application
Bzzzt!!! Wrong! Doesn't work that way
If it weren't for the need for sudo with ngrep, this wouldn't be a problem. I can't really chmod a+s ngrep without bringing devops down on my case hard.