Trying to capture output

We have our chef-client setup in client.rb to send the log to a log file.
And we have ‘verbose_logging true’ so that the output also goes to the
console. I need to capture that console output and I can’t seem to do it.
That leads me to believe that when chef is teeing that output it’s not
sending the 2nd stream to STDOUT. Otherwise I’d be able to capture it with
a simple ‘chef-client > chefout’

Any idea how chef is able to send that to my console without using STDOUT?
If I knew I might be able to figure out how to capture it. I don’t know
how to find that in the code but if someone could point me to it I might be
able to figure it out.

Or, if you just have the answer or know how to capture it you could just
tell me and that’d be ok too :slight_smile:

MG

Not sure why the console output isn’t being captured, perhaps it’s a bug? What version of Chef are you using?

If you’re looking to capture it to some alternate format, here’s a thread that touches on using syslog and splunk for capture chef-client output.
http://comments.gmane.org/gmane.comp.sysutils.chef.user/891

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray


From: Michael Glenney [mike.glenney@gmail.com]
Sent: Friday, October 12, 2012 2:13 PM
To: chef@lists.opscode.com
Subject: [chef] Trying to capture output

We have our chef-client setup in client.rb to send the log to a log file. And we have ‘verbose_logging true’ so that the output also goes to the console. I need to capture that console output and I can’t seem to do it. That leads me to believe that when chef is teeing that output it’s not sending the 2nd stream to STDOUT. Otherwise I’d be able to capture it with a simple ‘chef-client > chefout’

Any idea how chef is able to send that to my console without using STDOUT? If I knew I might be able to figure out how to capture it. I don’t know how to find that in the code but if someone could point me to it I might be able to figure it out.

Or, if you just have the answer or know how to capture it you could just tell me and that’d be ok too :slight_smile:

MG

On Friday, October 12, 2012 at 12:34 PM, Matt Ray wrote:

Not sure why the console output isn't being captured, perhaps it's a bug? What version of Chef are you using?

If you're looking to capture it to some alternate format, here's a thread that touches on using syslog and splunk for capture chef-client output.
http://comments.gmane.org/gmane.comp.sysutils.chef.user/891

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com (mailto:matt@opscode.com) | (512) 731-2218
Twitter, IRC, GitHub: mattray

From: Michael Glenney [mike.glenney@gmail.com (mailto:mike.glenney@gmail.com)]
Sent: Friday, October 12, 2012 2:13 PM
To: chef@lists.opscode.com (mailto:chef@lists.opscode.com)
Subject: [chef] Trying to capture output

We have our chef-client setup in client.rb to send the log to a log file. And we have 'verbose_logging true' so that the output also goes to the console. I need to capture that console output and I can't seem to do it. That leads me to believe that when chef is teeing that output it's not sending the 2nd stream to STDOUT. Otherwise I'd be able to capture it with a simple 'chef-client > chefout'

Any idea how chef is able to send that to my console without using STDOUT? If I knew I might be able to figure out how to capture it. I don't know how to find that in the code but if someone could point me to it I might be able to figure it out.

Or, if you just have the answer or know how to capture it you could just tell me and that'd be ok too :slight_smile:

MG
The meaning of verbose_logging changed, it no longer forces extra logging to STDOUT. Before Chef 10.14, Chef auto detects a TTY and outputs to STDOUT. Redirecting the output changes STDOUT so that it's not a TTY and disables the secondary logger.

After Chef 10.14, there's only a single destination for log output so you can send the logger to a file and get formatted output on STDOUT.

--
Daniel DeLeo

Thanks for the clarification. Makes sense now. We're running 10.12.
Sounds like I need to upgrade these or come up with a different scheme.

MG

On Fri, Oct 12, 2012 at 5:04 PM, Daniel DeLeo dan@kallistec.com wrote:

On Friday, October 12, 2012 at 12:34 PM, Matt Ray wrote:

Not sure why the console output isn't being captured, perhaps it's a
bug? What version of Chef are you using?

If you're looking to capture it to some alternate format, here's a thread
that touches on using syslog and splunk for capture chef-client output.
http://comments.gmane.org/gmane.comp.sysutils.chef.user/891

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

From: Michael Glenney [mike.glenney@gmail.com]
Sent: Friday, October 12, 2012 2:13 PM
To: chef@lists.opscode.com
Subject: [chef] Trying to capture output

We have our chef-client setup in client.rb to send the log to a log
file. And we have 'verbose_logging true' so that the output also goes to
the console. I need to capture that console output and I can't seem to do
it. That leads me to believe that when chef is teeing that output it's not
sending the 2nd stream to STDOUT. Otherwise I'd be able to capture it with
a simple 'chef-client > chefout'

Any idea how chef is able to send that to my console without using
STDOUT? If I knew I might be able to figure out how to capture it. I
don't know how to find that in the code but if someone could point me to it
I might be able to figure it out.

Or, if you just have the answer or know how to capture it you could just
tell me and that'd be ok too :slight_smile:

MG

The meaning of verbose_logging changed, it no longer forces extra logging
to STDOUT. Before Chef 10.14, Chef auto detects a TTY and outputs to
STDOUT. Redirecting the output changes STDOUT so that it's not a TTY and
disables the secondary logger.

After Chef 10.14, there's only a single destination for log output so you
can send the logger to a file and get formatted output on STDOUT.

--
Daniel DeLeo