Environment: CentOS6.6
Rsyslog+mysql+loganalyzer Environment Build Log server
Client End: 192.168.2.10
MySQL Server: 192.168.2.11
# Client -side installation of prerequisite packages
Yum Install Rsyslog-mysql-y
generates a 2 Files:
/lib64/rsyslog/ommysql.so #rsyslog支持数据库的模块文件/usr/share/doc/rsyslog-mysql-5.8.10/createdb.sql #创建rsyslog日志的数据库命令
# MySQL Server Configuration MySQL Database
Universal Binary Format package installation mariadb , the installation configuration step is skipped.
> Grant all privileges onsyslog.* to ' syslog ' @ ' 192.168.2.% ' identified by ' 123456 ';> flush privileges;> exit
# mysql-u syslog-h 192.168.2.11-p # Enter Password 123456 to test for normal access
# Client -End Installation MySQL to connect to the database
Yum Install mysql-y # executes MySQL command, requires first installing MySQL package mysql-u syslog-h 192.168.2.11-p</usr/share/doc/rsyslog-mysql-5.8.10/ Createdb.sql # Execute Create rsyslog database command on remote MySQL
# perform the above Createdb.sql then you can log in to MySQL to see if the database and related data tables have been generated.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/DF/wKiom1YI6ajSElRYAACv1LSKJ3c697.jpg "title=" 1.png " alt= "Wkiom1yi6ajselryaacv1lskj3c697.jpg"/>
# Configuration Rsyslog to support MySQL
Vi/etc/rsyslog.conf
Under the Modules module, add a: $ModLoad Ommysql under the Rules module, modify the following: Comment out the original *.info;mail.none;authpriv.none;cron.none/var/log/mes Sages add a record: *.info;mail.none;authpriv.none;cron.none:ommysql:192.168.2.11,syslog,syslog,123456
Format Description : Ommysql: Database Address : Database name : user name of the database : Database Password
Service Rsyslog Restart # Restart Rsyslog Log service
now, we can Yum after installing a software test, you will find that you are not /var/log/messages in the record.
# MySQL Server to see if you are receiving Client log information for:
> Use syslog;> SELECT * from SystemEvents \g; Will find a similar look, stating that there is no problem with our configuration.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/DC/wKioL1YI6cjxTVO3AADv_fM4tUA091.jpg "title=" 1.png " alt= "Wkiol1yi6cjxtvo3aadv_fm4tua091.jpg"/>
in the Client Configure front-end presentation tools for logs:
# Configuration Web Server
Yum install httpd php php-mysql php-gd-y
Write a test.php to the /var/www/html/ directory under
<?php $conn =mysql_connect (' 192.168.2.11 ', ' syslog ', ' 123456 '); if ($conn) echo "Success"; else echo "failure"; Mysql_close (); Phpinfo ();? >
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/DF/wKiom1YI6dmTJSlrAADaz0FFa_0075.jpg "title=" 1.png " alt= "Wkiom1yi6dmtjslraadaz0ffa_0075.jpg"/>
appear, explain Lamp build success.
# installation Loganalyzer
Cd/var/www/html/tar xf/home/tools/loganalyzer-3.6.5.tar.gz-c./cp-r loganalyzer-3.6.5/src/*./CP loganalyzer-3.6.5/ CONTRIB/*.SH./RM-FR src/rm-rf loganalyzer-3.6.5/chmod +x *.sh./configure.sh./secure.shchmod 666 config.php
# Configure on the browser side Loganalyzer
The configuration process is roughly as shown.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/DF/wKiom1YI6gjROakAAACjsaE9O-A376.jpg "style=" float: none; "title=" 1.png "alt=" Wkiom1yi6gjroakaaacjsae9o-a376.jpg "/>
# Note that step7 () needs to select MySQL Native, and enter the corresponding database address, database name, data table name, user name, password below.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/DC/wKioL1YI6hHjNxx-AAGIZEZqOgA684.jpg "style=" float: none; "title=" 2.png "alt=" Wkiol1yi6hhjnxx-aagizezqoga684.jpg "/>
After the installation is complete, refresh the Ere page. Should look like the following:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/DF/wKiom1YI6gmAMrKsAAR0wCVsk3M834.jpg "style=" float: none; "title=" 3.png "alt=" Wkiom1yi6gmamrksaar0wcvsk3m834.jpg "/>
Statistics page can see statistics, such as. But there is only one client-side monitoring statistic. We're going to add the MySQL server in the back.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/DC/wKioL1YI6hGyWelvAAG1-dEWmR8724.jpg "style=" float: none; "title=" 4.png "alt=" Wkiol1yi6hgywelvaag1-dewmr8724.jpg "/>
# MySQL Server also configure the log to be sent to the MySQL Save in database:
# Installing Rsyslog-mysql
Yum Install Rsyslog-mysql-y
# Configuration Rsyslog to support MySQL
Vi/etc/rsyslog.conf
Under the Modules module, add a: $ModLoad Ommysql under the Rules module, modify the following: Comment out the original *.info;mail.none;authpriv.none;cron.none/var/log/ Messages Add a record: *.info;mail.none;authpriv.none;cron.none:ommysql:192.168.2.11,syslog,syslog,123456
Service Rsyslog Restart # Restart Rsyslog Service
again in MySQL on the server casually Yum Ann loads several software packages and does the logging test.
# when viewed in a browser, you will find that you already have MySQL The record information
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/DC/wKioL1YI6vLASIYmAAGecBmMTsg100.jpg "title=" 5.png " alt= "Wkiol1yi6vlasiymaagecbmmtsg100.jpg"/>
Loganalyzer More features await you to discover ...
The same way, we can also follow the tutorial above to add more hosts to come in.
Rsyslog+mysql+loganalyzer Environment Build Log server