Add log socket support to syslog plugin. (Peter Eisch)

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@666 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2006-10-25 17:07:27 +00:00
parent 413d3c38d3
commit da93a9ca3b
2 changed files with 25 additions and 2 deletions

View File

@ -1,4 +1,6 @@
0.33 0.33
Add ability to specific socket for syslog (Peter Eisch)
Do the right thing for unimplemented AUTH mechanisms (Brian Szymanski) Do the right thing for unimplemented AUTH mechanisms (Brian Szymanski)
relay_only plugin for smart relay host. (John Peacock) relay_only plugin for smart relay host. (John Peacock)

View File

@ -17,7 +17,7 @@ configuration file:
=over =over
logging/syslog [loglevel l] [priority p] [ident str] [facility f] logging/syslog [loglevel l] [priority p] [ident str] [facility f] [logsock t]
For example: For example:
@ -74,11 +74,27 @@ The default is 'qpsmtpd'.
The syslog facility to which logged mesages will be directed. See syslog(3) The syslog facility to which logged mesages will be directed. See syslog(3)
for details. The default is LOG_MAIL. for details. The default is LOG_MAIL.
=item B<logsock>
The syslog socket where messages should be sent via syslogsock(). The valid
options are 'udp', 'tcp', 'unix', 'stream' and 'console'. Not all are
available on all systems. See Sys::Syslog for details. The default is
the above list in that order. To select specific sockets, use a comma to
separate the types.
=over
logsock udp,unix
logsock stream
=back
=back =back
=head1 AUTHOR =head1 AUTHOR
Devin Carraway <qpsmtpd@devin.com> Devin Carraway <qpsmtpd@devin.com>
Peter Eisch <peter@boku.net> (logsock support)
=head1 LICENSE =head1 LICENSE
@ -92,7 +108,7 @@ Please see the LICENSE file included with qpsmtpd for details.
use strict; use strict;
use warnings; use warnings;
use Sys::Syslog; use Sys::Syslog qw(:DEFAULT setlogsock);
sub register { sub register {
my ($self, $qp, @args) = @_; my ($self, $qp, @args) = @_;
@ -133,6 +149,11 @@ sub register {
$facility = $1; $facility = $1;
} }
if ($args{logsock}) {
my @logopt = split(/,/, $args{logsock});
setlogsock(@logopt);
}
unless (openlog $ident, $logopt, $facility) { unless (openlog $ident, $logopt, $facility) {
warn "Error opening syslog output"; warn "Error opening syslog output";
return; return;