Logstash安装logstash-integration-jdbc

Logstash安装logstash-integration-jdbc

1.版本说明

  • logstash7.10.1

2.前置条件

  • logstash-integration-jdbc是使用ruby语言开发的,因此需安装gem,gem是Ruby的一个包管理器

3.替换国内镜像

gem source --remove https://rubygems.org/
gem source --add https://gems.ruby-china.com/

**注:**网上主要说替换为https://ruby.taobao.org/和https://gems.ruby-china.org/,会出现Error fetching http://gems.ruby-china.org/的问题。taobao的ruby仓库镜像不可用了,而ruby-china.org由于备案问题需改成.com进行访问。

# 查看镜像
gem sources -l

# 替换后的结果如下
*** CURRENT SOURCES ***

https://gems.ruby-china.com/

4.修改Gemfile数据源地址

进入logstash,修改Gemfile

sudo vim Gemfile

将Gemfile的source换成https://gems.ruby-china.com/

source "https://gems.ruby-china.com/"

修改Gemfile.lock文件,将GEM remote修改为https://gems.ruby-china.com/

# 我的在33行左右
GEM
   remote: https://gems.ruby-china.com/

5.安装logstash-integration-jdbc

  • 老版本使用的是logstash-input-jdbc,安装时报如下错
plugin 'logstash-input-jdbc' is already provided by 'logstash-integration-jdbc'

所以我们直接安装logstash-integration-jdbc即可

# 进入logstash的bin目录
./logstash-plugin install logstash-integration-jdbc

# 显示如下信息即安装成功
Validating logstash-integration-jdbc
Installing logstash-integration-jdbc
Installation successful

6.运行时可能会报错Pipelines YAML文件为空

运行时,报如下错误

Pipelines YAML file is empty.

在config目录下修改pipelines.yml,将一下内容的注释去掉

- pipeline.id: test
  pipeline.workers: 1
  pipeline.batch.size: 1
  config.string: "input { generator {} } filter { sleep { time => 1 } } out    put { stdout { codec => dots } }"
- pipeline.id: another_test
  queue.type: persisted
  path.config: "/tmp/logstash/*.config"

重新跑自己写好的文件即可

./logstash -f ../config/test.conf
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值