chamber icon indicating copy to clipboard operation
chamber copied to clipboard

Logger writes to stdout, messing up output

Open jeffparsons opened this issue 2 years ago • 2 comments

Chamber writes log messages to stdout, which means they get intermingled with output that you might want to parse programmatically.

E.g.

[root@967ceb326552 dir-name]# chamber export -f json chamber-of-secrets
2023/06/03 09:39:34 WARN: failed to get session token, falling back to IMDSv1: 404 Not Found: Not Found
	status code: 404, request id: 
caused by: EC2MetadataError: failed to make EC2Metadata request
404 page not found

	status code: 404, request id: 
{"super_secret_password":"password"}

My workaround for now is to look for the first line that can be parsed as JSON. But... that's not ideal. :)

My hope is that I could either send all logs to stderr, disable them entirely, or set the minimum log level that will be printed.

jeffparsons avatar Jun 03 '23 09:06 jeffparsons

BTW, I'd be happy to submit a PR for this — would just like to know maintainers' preference first.

jeffparsons avatar Jun 04 '23 03:06 jeffparsons

Hey @jeffparsons - If you are still interested in contributing, I checked with our corporate overlords, and there is no problem at all with us accepting outside contributions. 🎉 Just be aware that your contributions will be licensed under the same MIT License that chamber already uses.

Thanks in advance!

bhavanki avatar Mar 07 '24 18:03 bhavanki