资源描述
首先安装apache,php,mysql为了方便这个我就使用yum安装
tar -xvf rsyslog-5.8.6.tar.gz
解压
./configure --prefix=/usr/local/rsyslog --enable-mysql
开始编译安装 –enable-mysql打开mysql支持
这里一般会遇到一个错误
../runtime/.libs/librsyslog.a(librsyslog_la-parser.o): In function `uncompressMessage':
/root/rsyslog-5.8.6/runtime/parser.c:247: undefined reference to `uncompress'
collect2: ld returned 1 exit status
make[2]: *** [rsyslogd] Error 1
make[2]: Leaving directory `/root/rsyslog-5.8.6/tools'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/rsyslog-5.8.6'
make: *** [all] Error 2
解决办法:
rsyslog-5.8.6]# vim runtime/parser.c
注释
247行//ret = uncompress((uchar *) deflateBuf, &iLenDefBuf, (uchar *) pszMsg+1, lenMsg-1);
重新编译
Make clean
Make && make install
rsyslog-5.8.6]# cp rsyslog.conf /etc/
vim /etc/rsyslog.conf
添加如下两行
$ModLoad ommysql
*.* :ommysql:localhost,Syslog数据库,用户名,密码
去掉如下两行前的注释
$ModLoad imudp.so # provides UDP syslog reception
$UDPServerRun 514 # start a UDP syslog server at standard port 514
完整配置文件如下:
# if you experience problems, check
# for assistance
# rsyslog v3: load input modules
# If you do not load inputs, nothing happens!
# You may need to set the module load path if modules are not found.
$ModLoad immark # provides --MARK-- message capability
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # kernel logging (formerly provided by rklogd)
$ModLoad ommysql
*.* :ommysql:localhost,Syslog,xiaosan,123456
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none -/var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* -/var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit -/var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
# Remote Logging (we use TCP for reliable delivery)
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$WorkDirectory /rsyslog/spool # where to place spool files
#$ActionQueueFileName uniqName # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList # run asynchronously
#$ActionResumeRetryCount -1 # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
# ######### Receiving Messages from Remote Hosts ##########
# TCP Syslog Server:
# provides TCP syslog reception and GSS-API (if compiled to support it)
#$ModLoad imtcp.so # load module
#$InputTCPServerRun 514 # start up TCP listener at port 514
# UDP Syslog Server:
$ModLoad imudp.so # provides UDP syslog reception
$UDPServerRun 514 # start a UDP syslog server at standard port 514
修改/etc/init.d/rsyslog,改成rsyslog目录
start() {
[ -x /usr/local/rsyslog/sbin/rsyslogd ] || exit 5
保存退出
导入数据库
mysql -u root -p < plugins/ommysql/createDB.sql
授权
grant all on Syslog.* to xiaosan@'localhost' identified by '123456';
flush privileges;
ln -s /usr/local/rsyslog/sbin/rsyslogd /sbin/rsyslogd
做一个软链接
loganalyzer安装
tar -xvf loganalyzer-3.2.3.tar.gz
cd loganalyzer-3.2.3
rsync -av src/* /var/www/html/
loganalyzer-3.2.3]# rsync -av contrib/* /var/www/html/
cd /var/www/html/
chmod +x *.sh
html]# ./configure.sh
html]# ./secure.sh
html]# chown -R apache.apache *
web登录:
http://xx.xx.xx.xx/
点击 here
点击next
确保config.php可写,点击next
选中Enable User Database后的yes 输入用户名密码,同事选中Require user to be logged in后的yes,点击next
点击next
点击next
输入管理员帐号密码,点击next
选择mysql native
这里注意表的大小写,这张图里的数据库名称错了,要改成Syslog,表名要修改成SystemEvents,并选中Enable Row Counting后的yes,点击next
点击finish结束安装。
客户端设置
*.* @rsyslog server的IP
展开阅读全文