bunyan-hub
v1.1.0
Published
centralised bunyan log aggregator through tcp
Downloads
3
Readme
bunyan-hub
A centralized bunyan log aggregator.
bunyan is a simple and powerful log module for node.js. This program is a server which collecting log events from all local node service. It simply start a tcp server on 28692 (BUNYA on phonepad) and waiting other node program to send new-line determined JSON string to it. You can use bunyan-hub-logger (or bunyan-pub-stream + bunyan) to push log to it and use bunyan-sub cli tool to subcribes to it with specified conditions. or use bunyan-sub-stream api for programing use.
I think the best part of it is that you can use bunyan-sub-stream to pipe to other bunyan-*-stream
s from npm.
I'm also planning develop a web dashboad for it like logio and then it would a killer app for having a local centralized log aggregator.
install
npm i -g bunyan-hub
usage
bunyanhub start
bunyanhub stop
You can also run bunyan-hub-server
directly, which is the same as run node server.js
in source directory. So you can use pm2 as the process supervisor.
pm2 start --name bunyan-hub `which bunyan-hub-server`
Then you can only stop it by pm2 stop bunyan-hub
, bunyanhub stop
will stop the instance but immediately restarted by pm2.
protocol
once connected to localhost:28692 which bunyan-hub listening, you could write a JSON with cmd
property ending with \n
or FIN.
{"cmd":"stop"}\n
will stop the server.{"cmd":"version"}\n
will give you bunyah-hub version back.{"cmd":"publish"}\n
will return you nothing, but expect you to further sending more JSON string which is in bunyan record format.{"cmd":"subscribe"}\n
will turn you tcp client into subscription mode, bunyan-hub will send you bunyan records in new-line determined JSON string.
usually you don't need to use raw TCP connection you self, instead using high level modules mentioned in the top section of this readme document.
license
MIT