The stuff before the JSON in heroku logs
output has to be cut off for
bunyan to work.
$ heroku logs | sed -l 's/.*app\[web\..*\]\: //' | bunyan
Flag -l
makes the output buffered by line.
alias bunyan-heroku="sed -l 's/.*app\[web\..*\]\: //' | bunyan"
$ heroku logs --tail | bunyan-heroku -o short
Previously used cut
and awk
, but found a better
solution,
for which a credit goes to @kennbrodhagen.
One might not want to see the non-bunyan log output that comes from
heroku[router]
.
In that case, pipe through grep:
alias buh="grep --line-buffered --color=none 'app\[web.\d\+\]' | sed -l 's/.*app\[web\..*\]\: //' | bunyan"
Tried sed -u and it worked for me. :)