kostya / eye

Process monitoring tool. Inspired from Bluepill and God.
MIT License
1.19k stars 86 forks source link

support logging to syslog #96

Closed melezhik closed 9 years ago

melezhik commented 9 years ago

stdall syslog would be very usefull

josqu4red commented 9 years ago

Agreed. I didn't think about that when I requested custom logger support.

kostya commented 9 years ago

You mean redirect process stdout to syslog?

if you know how to do it with Process#spawn function http://www.ruby-doc.org/core-2.1.2/Process.html#method-c-spawn or may be request this feature from ruby devs.

for example from ruby 2.0 they add :uid, :gid options to that method, by request. (https://bugs.ruby-lang.org/issues/6975)

josqu4red commented 9 years ago

Outputting to syslog cannot be managed by Process#spawn. It is not simple "redirecting" but writing to a given facility with a given log level and an application name. The process itself should offer the possibility to output to syslog, however many apps don't support it. So it could be interesting to enable it in Eye, even with static facility and level, using SyslogLogger for example (ruby 2.0+).

melezhik commented 9 years ago

in rails you may do following:


# cat Gemfile
gem 'syslogger'

# cat config/environments/prodcution.rb
config.logger = Syslogger.new

syslogger gem

kostya commented 9 years ago

i think this can be done like this, but this is little hacky:

for daemonize true:

process :bla do
  start_command "sh -c 'ruby -e \"loop { p 1; sleep 0.1}\" | logger'"
  daemonize true
  use_leaf_child true
end

and eye daemonize it, and would monitor only ruby process (because of use_leaf_child true), if it die parent shell process die too.

for daemonize false:

process :bla do
  start_command "sh -c 'ruby -e \"loop { p 1; sleep 0.1}\" | logger&'"
end

here would logs to syslog only daemonizer stdout

melezhik commented 9 years ago

Thanks, Kostya , but I meant more convenient way to do this.