-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add quiet mode #94
base: mainline
Are you sure you want to change the base?
Add quiet mode #94
Conversation
@chancez I'd like to help out with testing this. I built this change against the latest upstream and when I run it I get
without really knowing what I'm doing I made the following change which allows it to run...
Does this look right? |
Also trying this...
|
Yeah your most recent change looks correct, I guess I missed that. I'm not sure why I didn't hit the panic though 🤔 |
…rdcoding stdout Signed-off-by: Chance Zibolski <[email protected]>
Signed-off-by: Chance Zibolski <[email protected]>
ccc419c
to
3d071e6
Compare
Updated and rebased |
My test is an open SSH connection with this running
then I shut the node down via AWS API (it's a cloudformation thing for work). With that second change and
Versus this without it...
I'm going to call this a win! Nice one :D Is there anything else I can help with here? |
Thank you for this. I happened to run across the PR while trying to find a way to suppress these messages. This is making it difficult to do some ad-hoc scripting. As a user, my preference would be:
|
Not sure this will ever be merged by AWS, but nice work either way. I feel that it was improper design to ever send these informational messages to stdout in the first place. openssh has been around for a long time and set the standard here. I think ideally the messages would just start going there but it could break someone's existing scripting that assumed stdout would have these messages. I also think naming it "quiet" would be a little bit of a misnomer since it just redirects the output to stderr, which a typical user would not be thinking about when they enable quiet mode. |
Details
Closes #85
Introduces an env-var config option
AWS_SSM_QUIET
to disable writing information messages to stdout; instead sending them to stderr.Considerations: I kinda just went with stderr; but we could also just send them to
io.Discard
instead if that makes more sense to others.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Rationale
There's suggestions to use
grep
orhead
/tail
to filter these out; however this doesn't work in many cases for quite a few reasons:grep -v SessionId
will filter out lines withSessionId
coming from the remote host.cat
a binary file from the remote host and store that output locally; I have to filter theStarting session
output, theExiting session
output, and I need to ensure I remove the empty lines before/after the log messages too. Doing it correctly is quite difficult.The change is opt-in, meaning it won't effect anyone who doesn't configure
AWS_SSM_QUIET
, and in general; the output is still produced, but it goes to stderr which users will still see in their terminal, the only impact is if your passing the output of SSM to another program with the env-var set.