Issue #12402 has been updated by Michael Warren.

This should fix the problem in the logger itself.  The output now looks like 
this:

<pre>
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content) 
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content) --- 
/var/lib/puppet/state/last_run_summary.yaml        2012-02-03 
13:54:01.659471948 -0800
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content) +++ 
/tmp/puppet-file20120203-15345-14hr4zn-0   2012-02-03 13:58:44.436883387 -0800
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content) @@ -1,15 +1,15 @@
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content)  --- 
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content)    time: 
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content) -    group: 
0.000622
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content) -    last_run: 
1328306041
<daemon.notice> Feb  3 13:58:44 mvvm1b puppet-agent[15345]: 
(/File[/var/lib/puppet/state/last_run_summary.yaml]/content) -    service: 
0.736237
...
</pre>

<pre>
--- destinations.rb     2012-02-03 14:01:00.887546750 -0800
+++ /var/lib/gems/1.8/gems/puppet-2.7.10/lib/puppet/util/log/destinations.rb    
2012-02-03 14:02:31.483638995 -0800
@@ -30,12 +30,16 @@
     # cannot log a message with a '%' in it.  So, we get rid
     # of them.
     if msg.source == "Puppet"
-      @syslog.send(msg.level, msg.to_s.gsub("%", '%%'))
+      msg.to_s.split("\n").each do |line|
+        @syslog.send(msg.level, line.gsub("%", '%%'))
+      end
     else
-      @syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.gsub("%", ""),
-          msg.to_s.gsub("%", '%%')
-        ]
-      )
+      msg.to_s.split("\n").each do |line|
+        @syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.gsub("%", ""),
+            line.gsub("%", '%%')
+          ]
+        )
+      end
     end
   end
 end
</pre>

The patch in the previous update to content.rb can be ignored.  This patch 
addresses the problem in the logger itself.
----------------------------------------
Bug #12402: Puppet should include process/PID name when sending diff output to 
syslog.
https://projects.puppetlabs.com/issues/12402

Author: Michael Warren
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: puppet, syslog, diff, process, name, pid
Branch: 


Currently for most output while running the puppet agent, the syslog output 
looks like this for most messages:

<pre>
<daemon.info> Feb  2 18:18:55 mvvm1b puppet-agent[4855]: Retrieving plugin
<daemon.info> Feb  2 18:18:59 mvvm1b puppet-agent[4855]: Caching catalog for 
labmaster
<daemon.info> Feb  2 18:19:00 mvvm1b puppet-agent[4855]: Applying configuration 
version '1328234004'
</pre>

However, when puppet sends diff output to syslog, it doesn't include the 
"process-name[pid]" portion:

<pre>
<user.notice> Feb  2 17:53:28 mvvm1b --- 
/var/lib/puppet/state/last_run_summary.yaml    2012-02-02 17:53:03.801239692 
-0800
<user.notice> Feb  2 17:53:28 mvvm1b +++ 
/tmp/puppet-file20120202-4021-1fy9x5j-0        2012-02-02 17:53:27.970439343 
-0800
<user.notice> Feb  2 17:53:28 mvvm1b @@ -1,31 +1,31 @@
<user.notice> Feb  2 17:53:28 mvvm1b --- 
<user.notice> Feb  2 17:53:28 mvvm1b time: 
<user.notice> Feb  2 17:53:28 mvvm1b -    group: 0.000644
<user.notice> Feb  2 17:53:28 mvvm1b -    last_run: 1328233983
</pre>

This causes problems with parsing syslog messages because without the process 
name, a parser thinks that the process name is "---", "+++", "@@", etc.

Would it be possible to include the process name and PID in diff messages sent 
to syslog so the above would look like this:

<pre>
<user.notice> Feb  2 17:53:28 mvvm1b puppet-agent[4855]: --- 
/var/lib/puppet/state/last_run_summary.yaml    2012-02-02 17:53:03.801239692 
-0800
<user.notice> Feb  2 17:53:28 mvvm1b puppet-agent[4855]: +++ 
/tmp/puppet-file20120202-4021-1fy9x5j-0        2012-02-02 17:53:27.970439343 
-0800
<user.notice> Feb  2 17:53:28 mvvm1b puppet-agent[4855]: @@ -1,31 +1,31 @@
<user.notice> Feb  2 17:53:28 mvvm1b puppet-agent[4855]: --- 
<user.notice> Feb  2 17:53:28 mvvm1b puppet-agent[4855]: time: 
<user.notice> Feb  2 17:53:28 mvvm1b puppet-agent[4855]: -    group: 0.000644
<user.notice> Feb  2 17:53:28 mvvm1b puppet-agent[4855]: -    last_run: 
1328233983
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to