1、服務端配置
1.配置repl源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2.軟件包安裝
yum install -y mariadb mariadb-server rsyslog-mysql
3.啓動數據庫
systemctl start mariadb
systemctl enable mariadb
4.設置數據庫密碼
mysqladmin -u root password 123456
5.建立庫
cd /usr/share/doc/rsyslog-8.24.0/
mysql -uroot -p < mysql-createDB.sql
6.建立用戶並受權(登入數據庫)
grant all on Syslog.* to 'syslog'@'%'identified by 'syslogpw';
flush privileges;
7.修改配置文件
vim /etc/rsyslog.conf php
#MODULES $ModLoad imtcp $InputTCPServerRun 514 $ModLoad ommysql #RULES local7.* /var/log/boot.log *.* :ommysql:172.16.120.101,Syslog,syslog,syslogpw
8.重啓服務
systemctl restart rsyslog
9.驗證
logger "rsysylog test mysql"
mysql -uroot -p'123456' -e 'select * from Syslog.SystemEvents\G'
2、客戶端配置
1.安裝服務
yum install -y rsyslog-mysql
2.修改配置文件
vim /etc/rsyslog.confhtml
$ModLoad ommysql *.* :ommysql:192.168.1.55,Syslog,syslogroot,syslogpass
3.重啓服務
systemctl restart rsyslog
4.驗證
logger "client test 172.16.120.102"
3、安裝loganalyzer(服務端)
1.安裝依賴包
yum install -y httpd php php-mysqlnd php-gd
2.下載安裝包
wget http://download.adiscon.com/loganalyzer/loganalyzer-4.1.11.tar.gz
3.解壓配置
tar fx loganalyzer-4.1.11.tar.gz
cp -r loganalyzer-4.1.11/src/ /var/www/html/
cp -r loganalyzer-4.1.11/contrib/ /var/www/html/
cd /var/www/html/
sh configure.sh
4.啓動服務
systemctl start httpd
systemctl enable httpd
5.建立庫和用戶(登入數據庫)
create database loganalyzer;
grant all on loganalyzer.* to lyzer@'%' identified by 'lyzerpw';
flush privileges;
6.登陸
http://172.16.120.101/mysql