How To Configure Syslog Server in Linux
How To Configure Syslog Server in Linux
Here is the step by step Installation procedure of a Syslog Server. Here I Used Debian platform.
If you are in a deferent platform please check your file names and path.
openssh-server
openssh-client
apache2
libapache2-mod-php5
php5-cli
php5-common
php5-cgi
mysql-client
mysql-common
mysql-server
php5-mysql
php5-sqlite
php5-gd
Syslog-NG‟
Root@server # vi /etc/default/syslog-ng
CONSOLE_LOG_LEVEL=1
case “x$KERNEL_RINGBUF_SIZE” in
x[0-9]*)
dmesg -s $KERNEL_RINGBUF_SIZE
;;
x)
;;
*)
echo “KERNEL_RINGBUF_SIZE is of unaccepted value.”
;;
4, Configure /etc/syslog-ng/syslog-ng.conf
Source : http://sourceforge.net/projects/php-syslog-ng/
Root@server # vi /etc/syslog-ng/syslog-ng.conf
destination d_mysql {
pipe(“/var/log/mysql.pipe”
template(“INSERT INTO logs
(host, facility, priority, level, tag, datetime, program, msg)
VALUES ( „$HOST‟, „$FACILITY‟, „$PRIORITY‟, „$LEVEL‟, „$TAG‟, „$YEAR-$MONTH-
$DAY $HOUR:$MIN:$SEC‟,
„$PROGRAM‟, „$MSG‟ );\n”) template-escape(yes));
};
log {
source(s_all);
destination(d_mysql);
};
7, Create a script to run in the start-up
root@Server # vi /etc/syslog-ng/syslog2mysql.sh
#!/bin/bash
if [ ! -e /var/log/mysql.pipe ]
then
mkfifo /var/log/mysql.pipe
fi
while [ -e /var/log/mysql.pipe ]
do
mysql -u root –password=YOUR_PASS syslog < /var/log/mysql.pipe >/dev/null
done
/etc/syslog-ng/syslog2mysql.sh
Now we have too configure the PHP syslog ng, for that access your server via web browser (
http://youripaddress/install/install.php ) and follow the steps. after the installation you can access
your server via web ( http://youripaddress/ )
www.binbert.com