Last Comment Bug 836213 - log bugmail sent to the syslog
: log bugmail sent to the syslog
Status: RESOLVED FIXED
:
Product: bugzilla.mozilla.org
Classification: Other
Component: General (show other bugs)
: Production
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: Byron Jones ‹:glob›
:
Mentors:
Depends on:
Blocks: 839357
  Show dependency treegraph
 
Reported: 2013-01-30 00:37 PST by Byron Jones ‹:glob›
Modified: 2013-02-07 19:25 PST (History)
4 users (show)
See Also:
Due Date:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch v1 (1.52 KB, patch)
2013-01-30 00:37 PST, Byron Jones ‹:glob›
dkl: review+
Details | Diff | Review

Description Byron Jones ‹:glob› 2013-01-30 00:37:46 PST
Created attachment 708020 [details] [diff] [review]
patch v1

for diagnostic, auditing, and graphing purposes, i'd like to see all sent bugmail result in a syslog entry.

the attached patch generates lines which look like:
> [bugmail] byron.jones@gmail.com (CC) bug-1599 query doesnt show all bugs
recipient, reason, bug-id, and subject.
Comment 1 David Lawrence [:dkl] 2013-01-31 12:55:20 PST
Comment on attachment 708020 [details] [diff] [review]
patch v1

Review of attachment 708020 [details] [diff] [review]:
-----------------------------------------------------------------

Had to do:

-use Encode qw(find_encoding);
+use Encode qw(find_encoding decode_utf8);

to allow it to work. After that it was fine. 

Question: do we need to santize the subject for emails that are in one or more secure groups? 

dkl

::: extensions/BMO/Extension.pm
@@ +968,5 @@
> +    $message_type ||= '?';
> +
> +    $subject =~ s/[\[\(]Bug \d+[\]\)]\s*//;
> +
> +    openlog('apache', 'cons', 'pid', 'local4');

openlog('apache', 'cons,pid', 'local4');
Comment 2 Byron Jones ‹:glob› 2013-01-31 20:45:39 PST
(In reply to David Lawrence [:dkl] from comment #1)
> Question: do we need to santize the subject for emails that are in one or
> more secure groups? 

no, that syslog already contains things of a sensitive nature, so it's tightly secured.
Comment 3 Byron Jones ‹:glob› 2013-02-06 22:51:21 PST
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.0/
modified extensions/BMO/Extension.pm
Committed revision 8469.

Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.0/
modified extensions/BMO/Extension.pm
Committed revision 8470.

Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.2/
modified extensions/BMO/Extension.pm
Committed revision 8534.
Comment 4 David Lawrence [:dkl] 2013-02-07 15:33:34 PST
jobqueue was not able to deliver quite a few emails due to a wide character issue and so i have committed a small change to disable the feature for now until we can sort it out. Filed bug 839282 to ask for a BMO code push.

Error:

Wide character in syswrite at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Sys/Syslog.pm line 765. at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Sys/Syslog.pm line 765 Sys::Syslog::_syslog_send_socket('<165>Feb 7 05:22:55 apache[2970]: [bugma 

From my understanding of the docs (and I should have seen this before when doing the review :() we need to encode_utf8 instead of decode_utf8 as syslog needs the characters in bytestream (binary) format or octets. So maybe we just need to make one simple change?

@@ -962,7 +960,7 @@
     $subject =~ s/[\[\(]Bug \d+[\]\)]\s*//;
 
     openlog('apache', 'cons,pid', 'local4');
-    syslog('notice', decode_utf8("[bugmail] $recipient ($message_type) $bug_id $subject"));
+    syslog('notice', encode_utf8("[bugmail] $recipient ($message_type) $bug_id $subject"));
     closelog();
 }

dkl
Comment 5 Byron Jones ‹:glob› 2013-02-07 19:16:55 PST
nuts.  looks like this fix has been committed and pushed.
Comment 6 Byron Jones ‹:glob› 2013-02-07 19:25:03 PST
ah, the logging was disabled, not fixed.

to make it easier to track, i've filed a bug 839357

Note You need to log in before you can comment on or make changes to this bug.