PacketFence - BTS - PacketFence
View Issue Details
0000136PacketFencepublic2006-10-18 15:172008-09-19 12:43
bruce 
user4 
normalfeaturealways
closedfixed 
 
 
0000136: Logging enhancement to send stdout to syslog etc
Here is a patch which allows you to
choose what happens to stdout from pfmon based on a pf.conf parameter.
The benefit of doing this is that it means stdout errors get timestamped, and
it's easier to work out exactly what was happening when they occurred.

Basically, you create a new parameter called "stdout" in the "logging" section
of pf.conf


If this parameter is "syslog", then stdout will be redirected to the main
pf logfile.

If this parameter is "null", then stdout will be redirected to /dev/null

If this parameter has any other value, or is undefined, then stdout
will be redirected to /usr/local/pf/logs/pfmon as at present.

Requires a modification to pfmon, and trivial additions to pf.conf.default and documentation.conf

Bruce.

pfmon:

root@pf3:/usr/local/pf# diff bin/pfmon.OLD bin/pfmon
806,808d805
< #open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
< open STDOUT, '>>/usr/local/pf/logs/pfmon' or die "Can't write to /dev/null:
$!";
809a807,821
> if ($Config{'logging'}{'stdout'} =~ /^syslog$/i) {
> my $logfacility = $Config{'logging'}{'facility'};
> my $logpriority = $Config{'logging'}{'priority'};
> pflogger("Redirecting stdout to syslog, $logfacility,
$logpriority",20);
> open STDOUT, "|/usr/bin/logger -p ${logfacility}.${logpriority} " or
die "Can't write to syslog : $!";
> }
> elsif ($Config{'logging'}{'stdout'} =~ /^null$/i) {
> pflogger("Redirecting stdout to /dev/null",20);
> open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
> }
> else
> {
> pflogger("Redirecting stdout to logs/pfmon",20);
> open STDOUT, '>>/usr/local/pf/logs/pfmon' or die "Can't write to /dev/null:
$!";
> }
root@pf3:/usr/local/pf#


pf.conf.defaults:

root@pf3:/usr/local/pf# diff conf/pf.conf.defaults.OLD conf/pf.conf.defaults
477a478,482
> #
> # What to do with stdout from pfmon
> #
> stdout=
>


documentation.conf:

root@pf3:/usr/local/pf# diff conf/documentation.conf.OLD
conf/documentation.conf
648a649,655
> [logging.stdout]
> type=text
> description=<<EOT
> What to do with stdout from pfmon. Options are "null" to send to /dev/null,
> "syslog" to syslog via /usr/bin/logger to the main pf log file, and any other
value to redirect to logs/pfmon
> EOT
>
No tags attached.
child of 0000381closed user4 Log management 
Issue History
2006-10-18 15:17bruceNew Issue
2006-10-27 10:43kevmcsProjectPacketFence 1.6.2 => PacketFence 1.6.5
2008-06-12 20:38user4ProjectPacketFence 1.6.5 => PacketFence
2008-09-10 16:34user4Relationship addedchild of 0000381
2008-09-19 12:43user4Statusnew => assigned
2008-09-19 12:43user4Assigned To => user4
2008-09-19 12:43user4Statusassigned => closed
2008-09-19 12:43user4Note Added: 0000808
2008-09-19 12:43user4Resolutionopen => fixed

Notes
(0000808)
user4   
2008-09-19 12:43   
mtn revision 6283f586250069e6eb4dd5bec045ce8f8f4683d1