Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Deploy log server under Rsyslog+Loganalyer+MySQL

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Preparations for deploying log servers under Rsyslog+Loganalyer+MySQL (three Centos servers Centos7):

MySQL server (192.168.1.70): collect storage management logs

Web/Rsyslog server (192.168.1.52): build a httpd service to view log information on the web

Test server (192.168.1.71): generate logs and send log information to the Rsyslog server

Turn off the firewall and selinux

Configure the MySQL server

Install the MySQL service, create users, and authorize access to the Syslog database.

# yum-y install mariadb-server#systemctl start mariadb#mysql > GRANT ALL ON Syslog.* TO 'syslog'@'192.168.1.%' IDENTIFIED BY' syslogpass'; > FLUSH PRIVILEGES; > exit

Add the following three options to the configuration file of the mariadb server:

# vim / etc/my.cnfskip_name_resolve=oninnodb_file_per_table=on configuration test server (can be omitted)

All the log level (priority) generated by facility of the server is output to the Rsyslog server under info.

The server can be used to install and uninstall related software to test whether the web server and the database server can communicate properly.

Of course, it can also be used to test Rsyslog servers.

# vim / etc/rsyslog.conf # Log anything (except mail) of level info or higher.# Don't log private authentication messes.mail.nonescar.authpriv.nonepolitioncron.none / var/log/messages*.info;mail.none;authpriv.none;cron.none @ 192.168.1.52 deploy the Rsyslog server # yum-y install httpd php php-mysql php-gd#system start httpd

Create a new file to test whether PHP can communicate with MySQL (enter 192.168.1.52 in the browser and see OK, and you will succeed. )

# vim / var/www/html/index.php

Install the rsyslog-mysql package and create the database:

# yum-y install rsyslog-mysql# rpm-ql rsyslog-mysql/usr/lib64/rsyslog/ommysql.so/usr/share/doc/rsyslog-7.4.7/mysql-createDB.sql#mysql-usyslog-psyslogpass-h292.168.1.70

< /usr/share/doc/rsyslog-7.4.7/mysql-createDB.sql 这个时候你登陆数据库会看见数据库中多了Syslog库, >

SHOW DATABASES; +-+ | Database | +-+ | information_schema | | Syslog | +-+ 2 rows in set (0.00 sec) MariaDB [Syslog] > USE Syslog;Database changedMariaDB [Syslog] > SHOW DATABASES +-+ | Database | +-+ | information_schema | | Syslog | +-+

Enable the rsyslog server feature and configure to use the ommysql module

# enable tcp (recommended) or udp port # vim / etc/rsyslog.conf # Provides UDP syslog reception#$ModLoad imudp#$UDPServerRun 51 "Provides TCP syslog reception$ModLoad imtcp$InputTCPServerRun 51" add ommysql module # MODULES # $ModLoad ommysql# modify the destination address under RULES (format:" ommysql: database server HOST, database name, authorized user, password ") # RULES # * .info; mail.none;authpriv.none Cron.none / var/log/messages*.info;mail.none;authpriv.none;cron.none: ommysql:192.168.1.70,Syslog,syslog,syslogpass # systemctl restart rsyslog

Install loganalyer and configure:

# wget http://download.adiscon.com/loganalyzer/loganalyzer-4.1.2.tar.gz# tar-xf loganalyzer-4.1.2.tar.gz # cp-r loganalyzer-4.1.2/src/ / var/www/html/loganalyzer# cp loganalyzer-4.1.2/contrib/* / var/www/html/loganalyzer/# cd / var/www/html/loganalyzer/# chmod + x * .sh# chmod + x * .sh# ll * .sh-rwxr-xr-x 1 root root 49 May 26 18:37 configure.sh-rwxr-xr-x 1 root root 31 May 26 18:37 secure.sh#. / configure.sh #. / secure.sh# chmod 666 config.php install loganalyer in the browser

Pay attention to the version of loganalyer. If you are using a version above Centos7, it is best to use a version above loganalyer4.0, otherwise it is not compatible. Installation failed. Enter 192.168.1.52/loganalyzer/install.php in the browser to install and configure the relevant parameters.

Picture:

1. Just click NEXT by default.

Fill in the database HOST, library name, table name, user name and password, then NEXT, and then FINISH

2017-5-26 20:25:15

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report