Ask Your Question

why warning() nor notice() is not part of "report"

asked 2015-01-04 07:50:28 -0600

confiq gravatar image

updated 2015-01-05 03:11:33 -0600

According to functions docs warning() or notice() should log to the client server but the question is, why to log into puppet master log and not into report? Whenever I want to write something to report I have to use Notify{"yay":}?

Even more, the default settings does not save logs under /var/log/puppet/ or I might be wrong?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2015-01-05 02:19:15 -0600

domcleal gravatar image

I'm not sure where you see the docs saying those functions will log to the agent, as here it says:


Log a message on the server at level notice.

Anyway, the reason for this is that all function calls are executed while compiling manifests (.pp files) which is done by the Puppet master which compiles a "catalog" and returns it to the agent. They might do some computation of values (fqdn_rand, like cronjob timings), look up data (Hiera) or generate a file from a template. The values they return are then typically used when defining a resource, e.g. a cronjob minute property or a file content property, and that's sent down to the agent in the catalog.

For the logging functions, they too execute when compiling the manifests into a catalog, and logging is a side-effect. They don't return anything, so nothing is ever stored in the catalog (the catalog is a list of the resources for the agent to manage) and since the report is generated by the agent when applying the catalog, nothing's added there.

The notify { } resource type is different as it works like any other resource (file, service etc) and is sent to the agent in the catalog. The agent then evaluates it - just printing a message to the agent log - and because of this, it's added to the agent's report.

There are some very useful explanations and graphics in the Learning Puppet tutorial to show the overall workflow in agent/master mode, which may help:

Agent/master workflow

(from Learning Puppet — Basic Agent/Master Puppet)

Regarding log locations, syslog is the default location, so check /var/log/messages on Red Hat-like OSes, or /var/log/syslog or daemon.log on Debian. It logs to the daemon syslog facility by default. You can also override the --logdest when starting the Puppet agent or master to use a simple log file, but it's probably best to reconfigure (r)syslog if you need customisation.

edit flag offensive delete link more


Wow, Thank you for so detailed explanation. This is much more than I asked. Thank you again :)

confiq gravatar imageconfiq ( 2015-01-05 03:17:00 -0600 )edit

answered 2016-02-02 16:36:44 -0600

amirb gravatar image

Is there a way to use the Notify resource without causing puppet to report that the node has changed? Meaning just print the message to client log (and therefore the message will be visible in report) but without puppet classify the event as an applied configuration?

The reason is that when puppet triggers the Notify resource, Foreman flags the node as being active (changed)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-01-04 07:50:28 -0600

Seen: 1,300 times

Last updated: Feb 02 '16