Covert command output and exit status to json to pipe them atomically into logs
Install
gem install cmd2jsonor standalone
curl https://rubinjam.herokuapp.com/pack/cmd2json > cmd2json && chmod +x cmd2json
./cmd2json -vUsage
cmd2json -a 'foo=bar' echo hello | logger -t test
tail -1 /var/log/user.log
2016-12-08T00:34:17+00:00 app1.hostfoo.com test: {"timestamp":"2016-12-08 00:34:17 +0000", "message":"hello", "exit":"0", "foo":"bar"}TODO
-
--teeoption that still streams stdout and stderr - stdin support
Author
Michael Grosser
michael@grosser.it
License: MIT