[RADIATOR] [patch] AuthLogSYSLOG.pm new option LogOpt
Mike McCauley
mikem at open.com.au
Mon Mar 29 19:49:03 CDT 2010
Hello Bjoern,
thanks for this patch.
It has been applied with minor edits to AuthLog SYSLOG and also to Log SYSLOG.
The changes are now in the latest patch set.
Thanks again.
Cheers.
On Tuesday 30 March 2010 01:06:04 am Bjoern A. Zeeb wrote:
> Hi Hugh, Mike,
>
> please find attached a diff that lets one control the logopts passed to
> openlog(3) in AuthLogSYSLOG.pm.
>
> In case you do not want to validate the options, you can drop
> the entire 2nd hunk ("sub new") from the diff. It's a trade between
> Syslog internals and error catching. It's picky on whitespace.
> Openlog in native mode might not do the right thing in case of
> misconfiguration to my understanding and I had prefered to catch that
> as early as possible.
>
> We found we could save ~250MB of logs a day by just dropping
> the "[pid]" part.
>
> Best Regards,
> Bjoern
>
> PS: the patch was forward ported from 4.4 and not tested on latest;)
>
> --- Radius/AuthLogSYSLOG.pm.orig 2009-11-20 22:06:12.000000000 +0000
> +++ Radius/AuthLogSYSLOG.pm 2010-03-29 14:43:58.000000000 +0000
> @@ -38,2 +38,5 @@ use strict;
>
> + 'LogOpt' =>
> + ['string', 'This optional comma separated parameter specifies an
> alternative set of options for openlog(3). Defaults to \'pid\'.', 1], +
> 'LogHost' =>
> @@ -47,2 +50,17 @@ $Radius::AuthLogSYSLOG::VERSION = '$Revi
> #####################################################################
> +sub new
> +{
> + my ($class, $file, @args) = @_;
> +
> + my $self = $class->SUPER::new($file, @args);
> +
> + # Validate LogOpt.
> + map {
> + die "Invalid LogOpt '$_' to openlog(3)."
> + unless ($_ =~ /^(cons|ndelay|nofatal|nowait|perror|pid)$/)
> + } split /,/, $self->{LogOpt};
> +
> + return $self;
> +}
> +
> # Do per-instance default initialization
> @@ -64,2 +82,3 @@ sub initialize
> $self->{LogIdent} = $0;
> + $self->{LogOpt} = 'pid';
> }
> @@ -109,2 +128,3 @@ sub authlog
> my $ident = &Radius::Util::format_special($self->{LogIdent}, $p);
> + my $logopt = &Radius::Util::format_special($self->{LogOpt}, $p);
> eval {
> @@ -114,3 +134,3 @@ sub authlog
> if defined $self->{LogSock};
> - openlog($ident, 'pid', $self->{Facility});
> + openlog($ident, $logopt, $self->{Facility});
> syslog("$self->{Facility}|$self->{Priority}", $str);
--
Mike McCauley mikem at open.com.au
Open System Consultants Pty. Ltd
9 Bulbul Place Currumbin Waters QLD 4223 Australia http://www.open.com.au
Phone +61 7 5598-7474 Fax +61 7 5598-7070
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS, NetWare etc.
More information about the radiator
mailing list