Changing Logging for PortSentry
From: Bill
Parker
Date: Saturday, 24 June 2000 3:25 PM
Procedure to change logging for PortSentry to
separate log file:
IMPORTANT You may need to
change Logcheck if
running that on your system!
- Go to where portsentry source code is stored on your
system. Make copy of portsentry_config.h (in case you f**k
up). Edit portsentry_config.h and change
LOG_DAEMON to
LOG_LOCAL0 (enables local logging facility).
- Do kill -9 any
copies of PortSentry running on your system.
- Do ./make linux to
compile
- Do ./make install
to install
- Change to /etc and
edit syslog.conf
-
Add the following to info.* line: "local0" (using commas as separators)
Add a section to /etc/syslog.conf file which
reads:
# Log all the portsentry msgs
in one place. (local0)
local0.*
/var/log/portsentry
Since we are using local0 to redirect portsentry info, I
thought it should have it's own log file.
- If you want logs rotated on preset schedule, do the
following:
-
In /etc/logrotate.d
edit the syslog file
and add the following items (the logrotate program runs as
a cron job, btw).
/var/log/portsentry
{
compress
postrotate
/usr/bin/killall -HUP
syslogd
endscript
}
-
Stop and start the cron & syslog process by going to
/etc/rc.d/init.d and
issuing:
./cron stop
./cron start
./syslog stop
./syslog start
- Go to directory where PortSentry binary is stored, and
restart portsentry
- If everything works ok, you should have a file in
/var/log which has the
name PortSentry (do a cat on it, and you should see
PortSentry startup and log messages
- All done :-)