系统
Linux-centos7.4
MySQL-5.7 编译安装
PHP-7.0.30 编译安装
Nginx-1.10.2 编译安装
主机
192.168.10.181 web目录,前端展示界面,服务端,也是客户端
192.168.10.184 MySQL数据库
192.168.10.183 客户端
MySQL数据库服务器
192.168.10.184
mysql -uroot -p -h 192.168.10.184 登陆密码
创建rsyslog 用户在mysql下的相关权限
grant all on Syslog.* to 'sysloguser'@'192.168.%.%' identified by '123456';
或
grant all on syslog.* to 'sysloguser'@'192.168.%.%' identified by '123456';
select user,host,authentication_string from mysql.user;
quit
vim /usr/local/mysql-5.7.23/data/3306/my.cnf
[mysqld]
skip_name_resolve = on
innodb_file_per_table = on
重启MySQL服务
kill id号
/usr/loca/mysql-5.7.23/data/3306/mysql start
ss -ntl
192.168.10.181
yum -y install rsyslog-mysql
rpm -ql rsyslog-mysql
less /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
导入库文件,使用sysloguser用户
mysql -usysloguser -p -h192.168.10.184 < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
mysql -usysloguser -p -h 192.168.10.184
输入密码登陆
show databases; 显示有syslog数据库
show tables from syslog; 进入库中查看
select * from syslog.systemevents\G 空的
192.168.10.181
vim /etc/rsyslog.conf
如图1-2,修改处
systemctl restart rsyslog
1
2
192.168.10.183 客户端
vim /etc/rsyslog.conf
如下图3
systemctl restart rsyslog
3
192.168.10.181
logger "this is a test-n1-log1"
logger "this is a test-n1-log2"
192.168.10.183
logger "this is a test-n3-log1"
logger "this is a test-n3-log2"
192.168.10.181
mysql -usysloguser -p -h 192.168.10.184
输入密码登陆
show databases; 显示有syslog数据库
show tables from syslog; 进入库中查看
select * from syslog.systemevents\G 有内容了
192.168.10.181 前端展示
下载loganalyzer-4.1.6.tar.gz
tar xzf loganalyzer-4.1.6.tar.gz
cd loganalyzer-4.1.6
ll contrib/; ll src/
mv contrib/* src/; ls
mkdir /alidata/webapps/loganalyzer
cp -a src/* /alidata/webapps/loganalyzer/
cd /alidata/webapps/loganalyzer/
ll *.sh
chmod +x *.sh
./configure.sh
./secure.sh
二者运行完成会生成config.php,但是为空
ll config.php install.php
chmod 666 config.php
(3) 配置loganalyzer
浏览器:192.168.10.181/loganalyzer/install.php 进行安装
next
next
next
MySQL Native, Syslog Fields, Monitorware
Database Host 192.168.10.184
Database Name syslog
Database Tablename systemevents
Database User sysloguser
Database Password 123456
next
finish
菜单栏选项:
点击 Statistics
192.168.10.181
logger "this is a test-n1-log3"
logger "this is a test-n1-log4"
刷新界面,是否有新的日志产生
ssh 登陆产生的日志
192.168.10.182
ssh 192.168.10.181 输入密码登陆,再退出,看是否有日志产生
待定
网友评论