logstash同步nginx日志到数据库-创新互联
本文参考:/tupian/20230521/9436373.html /tupian/20230521/10360264.html -ivh logstash-6.6.2.rpm
成都创新互联-专业网站定制、快速模板网站建设、高性价比抚顺网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式抚顺网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖抚顺地区。费用合理售后完善,10多年实体公司更值得信赖。2.上传数据库驱动jar包
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.48.tar.gz
mkdir -p /usr/share/logstash/vendor/jar/jdbc cd /usr/share/logstash/vendor/jar/jdbc [root@localhost soft]# cd /usr/share/logstash/vendor/jar/jdbc [root@localhost jdbc]# ll total 984 -rw-r--r--. 1 logstash logstash 1006959 Jul 11 19:43 mysql-connector-java-5.1.48-bin.jar [root@localhost jdbc]#
3.数据库创建库 并授权用户
create database nginxlog; use nginxlog; CREATE TABLE `consumerlog` ( `client_ip` varchar(128) DEFAULT NULL, `log_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `status` int(6) DEFAULT NULL, `http_referer` text, `AgentVersion` varchar(512) DEFAULT NULL, ) grant all on nginxlog.* to nginxlog@'%' identified by '123456';
4.安装 logstash-output-jdbc插件
vim /usr/share/logstash/Gemfile # source "/tupian/20230521/rubygems.org" 将国外的源注释,换成国内的 source "https://gems.ruby-china.com/"
本文名称:logstash同步nginx日志到数据库-创新互联
本文URL:http://lswzjz.com/article/coiscs.html