Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log puppet agent and master

Tags:

syslog

puppet

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?

like image 467
palto Avatar asked May 04 '12 13:05

palto


2 Answers

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
}
like image 63
hajimuz Avatar answered Oct 23 '22 04:10

hajimuz


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.

like image 44
xeor Avatar answered Oct 23 '22 04:10

xeor