[Puppet-dev] Adding a new logging type to Puppet

12 views
Skip to first unread message

Paul Lathrop

unread,
Apr 20, 2010, 10:02:05 PM4/20/10
to puppe...@googlegroups.com
I'm trying to add support for logging to Scribe. I *think* what I need
to do is the following:

* Add a "feature" that checks if the scribe gem is installed. (add a
file lib/puppet/feature/scribe.rb)
* Add configuration options for the scribe server, port, and category.
* Create a new Puppet::Util::Log.newdesttype block in
lib/puppet/util/log/destinations.rb

I am having trouble understanding a couple of things here, hoping for some help.

1) How do I add configuration options and access them in the
destination type declaration?
2) How do I connect the "feature" to the code declaring the
destination? I think I do something like: if Puppet.features.scribe? -
is there more to it than that?
3) Is there somewhere else I need to hook into to make this work?

Thanks for the help.

--Paul

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppe...@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Luke Kanies

unread,
Apr 21, 2010, 12:55:27 PM4/21/10
to puppe...@googlegroups.com
On Apr 20, 2010, at 7:02 PM, Paul Lathrop wrote:

> I'm trying to add support for logging to Scribe. I *think* what I need
> to do is the following:
>
> * Add a "feature" that checks if the scribe gem is installed. (add a
> file lib/puppet/feature/scribe.rb)
> * Add configuration options for the scribe server, port, and category.
> * Create a new Puppet::Util::Log.newdesttype block in
> lib/puppet/util/log/destinations.rb
>
> I am having trouble understanding a couple of things here, hoping
> for some help.
>
> 1) How do I add configuration options and access them in the
> destination type declaration?
> 2) How do I connect the "feature" to the code declaring the
> destination? I think I do something like: if Puppet.features.scribe? -
> is there more to it than that?
> 3) Is there somewhere else I need to hook into to make this work?

Is this something you want to log to directly from the clients, or
would it be suitable to have the server do the logging when it
receives a report?

If the latter, then it's straightforward to write a report processor,
or even report terminus, that does the work.

If the former, then yeah, you have the right plan.

As to your quesitons:

1) There isn't currently any way for plugins to add new defaults
without some hackery. You'll essentially have to modify core Puppet
code somewhere, either lib/puppet/defaults.rb, or another file that
gets loaded by that file.

2) Yep, it's that easy.

3) You need to modify your executable to use your logdest. I think
the logdest option stopped working a while ago, but if it works then
it might be sufficient. Another option is to have your logdest value
be complex, so you'd say something like 'puppetd --logdest
scribe:servername:port'. Ugly, but meh. Note that logdest isn't a
normal Puppet default, just an argument to puppetd.

--
The brain is a wonderful organ. It starts working the moment you get
up in the morning and does not stop until you get into the office.
--Robert Frost
---------------------------------------------------------------------
Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199

Paul Lathrop

unread,
Apr 21, 2010, 1:15:39 PM4/21/10
to puppe...@googlegroups.com
Yeah, I figure this will be generally useful enough that I was going
to contribute it as a feature in core, anyway.

> 2) Yep, it's that easy.
>
> 3) You need to modify your executable to use your logdest.  I think the
> logdest option stopped working a while ago, but if it works then it might be
> sufficient.  Another option is to have your logdest value be complex, so
> you'd say something like 'puppetd --logdest scribe:servername:port'.  Ugly,
> but meh.  Note that logdest isn't a normal Puppet default, just an argument
> to puppetd.

Do you think that it would be reasonable to a) resurrect logdest and
b) make it configurable via puppet.conf?

--Paul

Luke Kanies

unread,
Apr 21, 2010, 1:56:06 PM4/21/10
to puppe...@googlegroups.com
Yep. And 'logserver' and 'logport' might be good things to have as
general parameters.

--
The most dangerous strategy is to jump a chasm in two leaps.
-- Benjamin Disraeli
---------------------------------------------------------------------
Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199

Paul Lathrop

unread,
Apr 21, 2010, 1:59:37 PM4/21/10
to puppe...@googlegroups.com
Thanks, this should give me enough to get started. Be prepared to be
bothered in IRC :-P

--Paul

Luke Kanies

unread,
Apr 21, 2010, 4:13:04 PM4/21/10
to puppe...@googlegroups.com
On Apr 21, 2010, at 10:59 AM, Paul Lathrop wrote:
[...]
> Thanks, this should give me enough to get started. Be prepared to be
> bothered in IRC :-P


I *live* prepared to be bothered in IRC. :)

--
The real art of conversation is not only to say the right thing at the
right place but to leave unsaid the wrong thing at the tempting
moment. -- Dorothy Nevill
---------------------------------------------------------------------
Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199

Reply all
Reply to author
Forward
0 new messages