目录
1、配置yum源
进行yum源更新配置
2、安装配置运行环境
2.1安装http、数据库、php环境、rsyslog数据库,并运行
yum -y install httpd mariadb mariadb-server php php-mysql mysql-devel rsyslog-mysql
systemctl restart mariadb
systemctl restart httpd
2.2配置http监听端口
配置监听端口
cd /etc/httpd/conf
vim httpd.conf
------配置-------------
#Listen 12.34.56.78:80
Listen 8081
ServerName localhost:8081
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
配置测试验证文件
systemctl restart httpd
测试html或php:切换到/var/www/html/
echo 192.168.63.130 > index.html
echo "<?php phpinfo();?>" > index.php
2.3创建数据库及用户
1、创建数据库rsyslog,此处的数据库是自己要使用的
create database rsyslog character set utf8 collate utf8_bin;
2、将rsyslog数据库的权限全部授予用户rsyslog,本地登录
grant all privileges on rsyslog.* to 'rsyslog'@'localhost' identified by 'rsyslog';
flush privileges;
3、将rsyslog数据库的文件进行导入,这是生成Syslog库
mysql -uroot -p*** < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
4、将Syslog数据库的权限全部授予用户rsyslog,远程登录
grant all privileges on Syslog.* to 'rsyslog'@'%' identified by 'rsyslog';
flush privileges;
3、上传loganalyzer安装包
将安装放在/srv下,并解压
tar -zxvf /srv/loganalyzer-4.1.13.tar.gz
将解压后loganalyzer-4.1.13
目录下的src
及contrib
复制到/var/www/html
下
cp -a contrib/ /var/www/html/
cp -a src/ /var/www/html/
4、后台配置
进入/var/www/html/contrib
添加可执行
权限
chmod +x *.sh
执行文件
./configure.sh
将生成的配置文件拷贝到/var/www/html/src
下
vim /etc/rsyslog.conf
$ModLoad ommysql
*.* :ommysql:localhost,Syslog,rsyslog,rsyslog
$ModLoad imudp
$UDPServerRun 514
$UDPServerRun 38514
$ModLoad imtcp
$InputTCPServerRun 514
$InputTCPServerRun 38514
重启日志管理
5、web页面配置
访问http://192.168.63.130:8081/src/install.php
5.1 step 1
5.2 step 2
此步骤如果有报错
,检查/var/www/html/srv
下的config.php
权限是不是644
5.3 step 3
5.4 step 4
5.5 step 5
5.6 step 6
5.7 step 7
需要注意字母大小写
,注意字母大小写
,注意字母大小写
5.8 step 8
服务端
# File to store the position in the journal
$IMJournalStateFile imjournal.state
$template IpTemplate,"/var/log/%FRomHOST-IP%.log"
*.* ?IpTemplate
$template IpTemplate(“IpTemplate” 可自定义)指令使 rsyslog 后台进程将日 志消息写到 /var/log 下的单独的本地日志文件中,其中日志文件的名称是基于远 程日志发送机器的主机名以及生成该日志的应用程序名进行定义的。
. ?IpTemplate 将 IpTemplate 模板应用到所有接收到的日志上 。
客户端
*.* @@ip:514
交换机
#进入用户视图
system-view
#指定发送消息基本,表示从0-7都发送
info-center source default channel 2 log level debugging
#指定从哪个接口发送
info-center loghost source MEth 0/0/0
#指定远程syslog服务器ip
info-center loghost ip