1、loganalyzer服务器搭建
[root@localhost ~]# getenforce #查看selinux是否关闭
[root@localhost ~]# setenforce 0 #临时关闭;修改配置文件/etc/selinux/config,将其中SELINUX设置为disabled(永久关闭)
[root@localhost ~]# systemctl status firewalld.service
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# yum -y install mariadb mariadb-server
[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# /bin/mysql_secure_installation #初始化mariadb数据库
[root@localhost ~]# yum list rsyslog*
[root@localhost ~]# yum -y install rsyslog-mysql
[root@localhost ~]# mysql -uroot -proot </usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
MariaDB [(none)]> grant all privileges on Syslog.* to 'rsyslog'@'%' identified by 'rsyslog';flush privileges;
[root@localhost ~]# vim /etc/rsyslog.d/loganalyzer.conf
$ModLoad ommysql
#所有日志 :ommysql:数据库地址,数据库名,登陆数据库的用户,用户密码
*.* :ommysql:localhost,Syslog,rsyslog,rsyslog
#使用UDP协议传输
$ModLoad imudp
$UDPServerRun 514
$UDPServerRun 38514
#使用TCP协议传输(两者可同时使用)
$ModLoad imtcp
$InputTCPServerRun 514
$InputTCPServerRun 38514