Project

cmd2json

0.0
No commit activity in last 3 years
No release in over 3 years
Covert command output and exit status to json to pipe them atomically into logs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 0
 Project Readme

Covert command output and exit status to json to pipe them atomically into logs

Install

gem install cmd2json

or standalone

curl https://rubinjam.herokuapp.com/pack/cmd2json > cmd2json && chmod +x cmd2json
./cmd2json -v

Usage

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

  • --tee option that still streams stdout and stderr
  • stdin support

Author

Michael Grosser
michael@grosser.it
License: MIT
Build Status