[chef] Re: Logging chef-client activity to syslog - how?


Chronological Thread 
  • From: Jesse Campbell < >
  • To: chef < >
  • Subject: [chef] Re: Logging chef-client activity to syslog - how?
  • Date: Fri, 21 Dec 2012 19:40:08 -0500

Ooh! this would be perfect if it worked.
I'm currently modifying the chef-client recipe to pipe all output to /usr/bin/logger. Please post if you get it to work?


On Thu, Dec 20, 2012 at 5:45 PM, Chris Sibbitt < " target="_blank"> > wrote:

Hello, I am trying to get chef-client to log to syslog. I am running 10.16.2 and I have found info about this in the JIRA system (http://tickets.opscode.com/browse/CHEF-273)

 

I installed SyslogLogger and tested it with a simple check script that works just fine:

 

require 'rubygems'

require 'syslog_logger'

logobj = SyslogLogger.new("chef-client")

logobj.info('test')

 

This is my client.rb:

 

require 'syslog_logger'

log_level :info

log_location SyslogLogger.new("chef-client")

chef_server_url 'http://MYCHEFSERVER:4000'

validation_client_name 'chef-validator'

 

When I run chef-client I get nothing in syslog, so I tried this client.rb based on a snippet I stumbled across at random (https://gist.github.com/787164)

 

require 'syslog_logger'

Chef::Log.logger = SyslogLogger.new("chef-client")

log_level :info

Chef::Log.logger.info("Sanity Check")

log_location STDOUT

chef_server_url 'http://MYCHEFSERVER:4000'

validation_client_name 'chef-validator'

 

Running chef-client results in “Sanity Check” in my logs, but nothing after that. I suspected a bug like this one (http://tickets.opscode.com/browse/CHEF-1985 ) and instrumented the chef-client source code enough to see that indeed the custom log destination works right up until init() is called in mixlog, but I’m not yet very adept at ruby and didn’t get to the bottom of it this way.

 

I tried a variety of other syslog gems as well with various combinations and could not find anything that works.

 

The tickets suggest that logging to syslog is supported, and even that it is the default behavior, but I just can’t get it to work. Can someone point out what I am doing wrong or suggest something to try?





Archive powered by MHonArc 2.6.16.

§