How to log puppet agent and master
Solution 1
We are using puppet-dashboard for this purpose. It will give you a good overview on the environment, what is failing and what is working. And which servers have stopped checking in.
Its easy to setup, checkout http://puppetlabs.com/puppet/related-projects/dashboard/
If you want to log to a different file, you can use the syslogfacility configuration option in puppet ( http://docs.puppetlabs.com/references/stable/configuration.html#syslogfacility ), and configure syslog to log it to a different file.
Solution 2
Since your mentioned syslog
, I assume you were talking about Debian-like Linux.
Actually there is no need to write your own log facility. Customizing /etc/default/puppet
is enough.
# Startup options
DAEMON_OPTS="--logdest /var/log/puppet/puppet.log"
/etc/default/puppet
is sourced by /etc/init.d/puppet
, so the options you added here will be executed when puppet
service is started.
Docs about --logdest
options : https://docs.puppetlabs.com/references/3.3.1/man/apply.html#OPTIONS
BTW, the deb package puppet provides for Debian(or Ubuntu) even includes a logrotate configuration file for /var/log/puppet
, I don't know why this option is not default.
/var/log/puppet/*log {
missingok
sharedscripts
create 0644 puppet puppet
compress
rotate 4
postrotate
pkill -USR2 -u puppet -f 'puppet master' || true
[ -e /etc/init.d/puppet ] && /etc/init.d/puppet reload > /dev/null 2>&1 || true
endscript
}
palto
Updated on June 15, 2022Comments
-
palto almost 2 years
Puppet writes logging by default to syslog. Why is that? Most software write to some separate logfile. I checked the documentation and there is a mention that you can write to a log file but there was a mention that "This is generally not used." Is it a bad idea?
What is the typical setup for following the puppet logging? Using grep on the /var/log/messages file?
-
palto almost 12 yearsAny tips on how to log using syslog to log puppet to a different file. There is no 'puppet' syslogfacility and the default is daemon. If I log daemon to a puppet.log-file, then other stuff than puppet will end up in there too.
-
xeor almost 12 yearsI dont know, but I guess it is possible. You can find every puppet config using; puppet --configprint all
-
palto almost 12 yearsBut how do people usually handle logging with puppet? Do you consider it a non issue to grep the syslog? Puppet does allow logging to different files, so if syslog is hard to separate to different log files then I can always use puppet to do it. I'm just wondering why it is "generally not used"
-
xeor almost 12 yearsI use puppet-dashboard. So everything puppet got is gathered on that nice lille web interface. If there is any puppet errors, it will be there. If puppet stops sending logs, it will complain that the agent doesnt send any logs.. Use puppet logging locally for debugging.
-
xeor almost 12 yearsYou wont regret it :) The dashboard is very good for logging, just ignore the part of it where you can add servers to puppet classes and so on (if you are only using it for logging). Else it is nice to create groups of servers and give them classes as well. Just check it out
-
vikas027 over 8 yearsNice, this works for puppet agent in v4.2.2 as well like this
PUPPET_EXTRA_OPTS="--logdest /var/log/puppetlabs/puppet/puppet.log"
Puppet Master however goes by default here/var/log/puppetlabs/puppetserver/puppetserver.log