Logging to syslog

I see from the documentation (
http://wiki.opscode.com/display/chef/Chef+Configuration+Settings#ChefConfigurationSettings-logoutput)
that it is possible to log to syslog, but the link that I guess is supposed
to explain how to do so is broken. I’m afraid I’m not a Ruby person so,
while I realise the config file is just Ruby and it’s probably a simple task
to do so, I’m not entirely sure how to do it without a pointer or two, and
this is functionality I couldn’t use Chef without (we have to have all our
logs centralised, which obviously is fairly easy to take care of when using
syslog).

Thanks,
Oliver

The page that was linked off to from that bad link was blank. It was
started by "Rafael" in 2010 by creating a page with the title, but there was
no content.

I've created a page "Advanced Configuration Settings with Ruby", and put the
readme from the mixlib-log that is linked to at
http://wiki.opscode.com/display/chef/Chef+Configuration+Settings#ChefConfigurationSettings-logoutput
.

Those with knowledge on how to make it more than that can either edit the
page directly, or send me the information.

  • Tom

On Tue, Jul 19, 2011 at 6:13 AM, Oliver Beattie oliver@luckyvoice.comwrote:

I see from the documentation (
http://wiki.opscode.com/display/chef/Chef+Configuration+Settings#ChefConfigurationSettings-logoutput)
that it is possible to log to syslog, but the link that I guess is supposed
to explain how to do so is broken. I'm afraid I'm not a Ruby person so,
while I realise the config file is just Ruby and it's probably a simple task
to do so, I'm not entirely sure how to do it without a pointer or two, and
this is functionality I couldn't use Chef without (we have to have all our
logs centralised, which obviously is fairly easy to take care of when using
syslog).

Thanks,
Oliver

On Tue, Jul 19, 2011 at 3:13 PM, Oliver Beattie oliver@luckyvoice.com wrote:

I see from the documentation
(http://wiki.opscode.com/display/chef/Chef+Configuration+Settings#ChefConfigurationSettings-logoutput)
that it is possible to log to syslog, but the link that I guess is supposed
to explain how to do so is broken. I'm afraid I'm not a Ruby person so,
while I realise the config file is just Ruby and it's probably a simple task
to do so, I'm not entirely sure how to do it without a pointer or two, and
this is functionality I couldn't use Chef without (we have to have all our
logs centralised, which obviously is fairly easy to take care of when using
syslog).

Hi,

I had a look a while ago and had to dig a little bit to find the
solution. I don't have
access to the system I configured right now but, if I remember correctly, you
have to install the SyslogLogger gem and then modify /etc/chef/client.rb or
server.rb to add:

require 'syslog_logger'
log_location SyslogLogger.new("chef-client")

If you are using the supplied startup scripts for RedHat-base
distributions, please
note that they insist on configuring the logger in
/etc/sysconfig/chef-{client,server}.
You might have to manually modify the startup script for the logging to work
as intended.

Best info I've seen seems to be in tickets:

http://tickets.opscode.com/browse/CHEF-273
http://tickets.opscode.com/browse/CHEF-1985

Going to be trying this myself soon. Also, you may be interested in
the splunk handler, which I want to play with after syslog is working:

Please add your experience to the wiki if you get it working.

On Tue, Jul 19, 2011 at 9:16 AM, Eric-Olivier Lamey eolamey@gmail.com wrote:

On Tue, Jul 19, 2011 at 3:13 PM, Oliver Beattie oliver@luckyvoice.com wrote:

I see from the documentation
(http://wiki.opscode.com/display/chef/Chef+Configuration+Settings#ChefConfigurationSettings-logoutput)
that it is possible to log to syslog, but the link that I guess is supposed
to explain how to do so is broken. I'm afraid I'm not a Ruby person so,
while I realise the config file is just Ruby and it's probably a simple task
to do so, I'm not entirely sure how to do it without a pointer or two, and
this is functionality I couldn't use Chef without (we have to have all our
logs centralised, which obviously is fairly easy to take care of when using
syslog).

Hi,

I had a look a while ago and had to dig a little bit to find the
solution. I don't have
access to the system I configured right now but, if I remember correctly, you
have to install the SyslogLogger gem and then modify /etc/chef/client.rb or
server.rb to add:

require 'syslog_logger'
log_location SyslogLogger.new("chef-client")

If you are using the supplied startup scripts for RedHat-base
distributions, please
note that they insist on configuring the logger in
/etc/sysconfig/chef-{client,server}.
You might have to manually modify the startup script for the logging to work
as intended.