From e497100c07aa95e315c4c881d54cb88e57675e80 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 23 Jul 2015 12:24:32 +0800 Subject: Bug 1185823 - add additional [audit] syslog entries --- Bugzilla.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index afaf77395..8a0ff2fd7 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -59,11 +59,13 @@ use Bugzilla::Metrics::Collector; use Bugzilla::Metrics::Template; use Bugzilla::Metrics::Memcached; +use Date::Parse; +use DateTime::TimeZone; +use Encode; use File::Basename; use File::Spec::Functions; -use DateTime::TimeZone; -use Date::Parse; use Safe; +use Sys::Syslog qw(:DEFAULT); ##################################################################### # Constants @@ -659,6 +661,14 @@ sub local_timezone { ||= DateTime::TimeZone->new(name => 'local'); } +# Send messages to syslog for the auditing systems (eg. mozdef) to pick up. +sub audit { + my ($class, $message) = @_; + openlog('apache', 'cons,pid', 'local4'); + syslog('notice', '[audit] ' . encode_utf8($message)); + closelog(); +} + # This creates the request cache for non-mod_perl installations. # This is identical to Install::Util::_cache so that things loaded # into Install::Util::_cache during installation can be read out @@ -1047,6 +1057,10 @@ this Bugzilla installation. Tells you whether or not a specific feature is enabled. For names of features, see C in C. +=item C + +Feeds the provided message into our centralised auditing system. + =back =head1 B @@ -1126,4 +1140,3 @@ information. =back =back - -- cgit v1.2.3-24-g4f1b