标签:centos 下利用rsyslog+loganalyzer+mysql部署日志服务器
一、安装并设置LAMP环境
yum -y install httpd mysql* php*
二、安装Rsyslog
服务器端:
yum install rsyslog rsyslog-mysql
rsyslog-mysql :将日志传送到MySQL 数据库
mysql -uroot -p1234 < /usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql
配置数据权限
# mysql -uroot –p
mysql> grant all on Syslog.* to syslog@localhost identified by ‘syslog‘;
mysql> flush privileges;
mysql> exit
修改配置文件
more /etc/rsyslog.conf
#### MODULES ####
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
$ModLoad immark # provides --MARK-- message capability
###Mysql####
$ModLoad ommysql.so
*.* :ommysql:localhost,Syslog,syslog,syslog
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
#Log file 动态生产日志文件
$template logfile, "/data/rsyslog/%fromhost-ip%_%$year%%$month%%$day%.log"
*.* ?logfile
重启 rsyslog
service rsyslog restart
客户端:
# yum install rsyslog -y
配置rsyslog客户端发送本地日志到服务端
# vi /etc/rsyslog.conf
末行添加如下内容
-------------------
*.* @rsyslog 服务器IP
重启 rsyslog
service rsyslog restart
三、安装部署LogAnalyzer
# wget http://download.adiscon.com/loganalyzer/loganalyzer-3.6.5.tar.gz
# tar zxf loganalyzer-3.6.5.tar.gz
# cd loganalyzer-3.6.5
# mkdir -p /data/www/loganalyzer
复制loganalyzer源代码到apache的DocumentRoot下loganalyzer目录
# cp -r src/* /data/www/loganalyzer
# cp -r contrib/* /data/www/loganalyzer
通过web向导安装loganalyzer前,必须先执行以下两个脚本
# cd /data/www/loganalyzer/
# sh configure.sh
# sh secure.sh
#chown -R apache.apache/data/www/loganalyzer
WEB端配置
(略)
CentOS 下利用Rsyslog+LogAnalyzer+MySQL部署日志服务器
标签:centos 下利用rsyslog+loganalyzer+mysql部署日志服务器
原文地址:http://961911.blog.51cto.com/951911/1590175