sirvlog - centralized log server for applications
sirvlog is Node based centralized log server for applications.
Features
- JSON-based messages
- server-side filters in Javascript
- uses ElasticSearch
- supports syslog protocol (tcp only)
- fast
See also
Getting started
-
Make sure you have ElasticSearch installed and running
-
Install sirvlog by either cloning this repo or with npm:
$ npm install sirvlog
-
Edit config.js to reflect your needs
-
Start server:
$ node server.js
supervisord service
Running assupervisord is a great tool to run your Node apps as it allows you to have full control over running services (as well as monitoring their health status )
So the typical config will be
### Syslog redirection$ cat /etc/supervisor.d/sirvlog.conf[program:sirvlog]command=/home/nvm/v0.10.0/bin/node /home/sirvlog/src/server.js --config /home/sirvlog/config.jsprocess_name=sirvlognumprocs=1numprocs_start=0autostart=trueautorestart=truestartsecs=1startretries=3exitcodes=0,2stopsignal=TERMstopwaitsecs=10user=www-dataredirect_stderr=truestdout_logfile=/home/sirvlog/logs/sirvlog.logstdout_logfile_maxbytes=50MBstdout_logfile_backups=10stdout_capture_maxbytes=0stdout_events_enabled=falsestderr_logfile=AUTOstderr_logfile_maxbytes=50MBstderr_logfile_backups=10stderr_capture_maxbytes=0stderr_events_enabled=falseserverurl=AUTO
$ cat /etc/rsyslog.d/99-sirvlog.conf*.* @@sirvlog.company.com:10514
Node.JS client example:
// connect to sirvlog servervar sirvlog =;// register 'error' event handlersirvlog;// log a message with custom object attachedsirvlog;
PHP client example:
Ruby client example:
# encoding: utf-8sirvlog = SirvlogClient.new({"facility" => "ruby",'server' => {'address' => '127.0.0.1','port' => 12514},})sirvlog.log("hello", "backtrace", __FILE__, __LINE__, {"i" => 1});
Opscode Chef hanlder:
# sirvlog code is here:deploy_path = "/home/sirvlog"chef_handler "SirvLog::SirvLog" dosource "/ruby/chef-handler/sirvlog.rb"arguments [{"facility" => "chef",'server' => {'address' => '127.0.0.1','port' => 12514}}]only_if doFile.exists?("/ruby/chef-handler/sirvlog.rb")endaction :nothingend.run_action(:enable)
Authors
Oleksiy Krivoshey
License (MIT)
Copyright (c) 2013 Sirv.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.