目录
一、查找插件
二、安装插件
1.使用插件名安装
2.使用gem文件安装
三、插件存放位置
四、不联网安装方式
五、查看安装结果
以安装插件logstash-output-jdbc,使用logstash-7.13.0为例进行说明
登录rubygems网站,网址:https://rubygems.org
查到插件后,页面为:https://rubygems.org/gems/logstash-output-jdbc
可以从上面下载到最新版本的插件,当前最新版本的文件名:logstash-output-jdbc-5.4.0.gem
如果能上网,可以直接通过命令下载并安装,这种安装方式最简单:
D:\Programs\logstash-7.13.0\bin>logstash-plugin install --no-verify logstash-output-jdbc
Installing logstash-output-jdbc
Installation successful
此时只需要使用插件名,插件名中不用带版本号,否则会报错:
D:\Programs\logstash-7.13.0\bin>logstash-plugin install --no-verify logstash-output-jdbc-5.4.0
Plugin not found, aborting
ERROR: Installation Aborted, message: Could not find gem 'logstash-output-jdbc-5.4.0 java' in any of the gem sources listed in your Gemfile.
但很多时候,安装环境无法访问外部网,此时需要先做第一步,把插件下载下来再安装
此时需要给install添加新参数,查看install下子参数的方式:
D:\Programs\logstash-7.13.0>.\bin\logstash-plugin install -h
Usage:
bin/logstash-plugin install [OPTIONS] [PLUGIN] ...Parameters:
[PLUGIN] ... plugin name(s) or fileOptions:
--version VERSION version of the plugin to install
--[no-]verify verify plugin validity before installation (default: true)
--preserve preserve current gem options (default: false)
--development install all development dependencies of currently installed plugins (default: false)
--local force local-only plugin installation. see bin/logstash-plugin package|unpack (default: false)
-h, --help print help
将logstash-output-jdbc-5.4.0.gem文件放置到D:\Programs\logstash-7.13.0目录下,使用如下命令,同时要使用插件的全文件名:
D:\Programs\logstash-7.13.0>bin\logstash-plugin install --local logstash-output-jdbc-5.4.0.gem
Validating logstash-output-jdbc-5.4.0.gem
Installing logstash-output-jdbc
Installation successful
此时,插件文件名不能带路径,否则也会报错:
D:\Programs\logstash-7.13.0\bin>logstash-plugin install --local D:\Programs\logstash-7.13.0\logstash-output-jdbc-5.4.0.gem
ERROR: Something went wrong when installing D:\Programs\logstash-7.13.0\logstash-output-jdbc-5.4.0.gem, message: bad URI(is not URI?): https://artifacts.elastic.co/downloads/logstash-plugins/D:\Programs\logstash-7.13.0\logstash-output-jdbc-5.4.0.gem/D:\Programs\logstash-7.13.0\logstash-output-jdbc-5.4.0.gem-7.13.0.zip
此种方式在有些logstash的版本中可以作为不联网安装方式
安装完成后会在D:\Programs\logstash-7.13.0\Gemfile文件中添加如下记录:
gem "logstash-output-jdbc", "5.4.0", :path => "vendor/local_gems/0e11c1ff/logstash-output-jdbc-5.4.0"
logstash-output-jdbc插件会放置到vendor/local_gems目录下:
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0>dir /S /B
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\CHANGELOG.md
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\Gemfile
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\logstash-output-jdbc.gemspec
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\README.md
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\THANKS.md
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\vendor
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\com
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\log4j
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\logstash
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\logstash-output-jdbc_jars.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\com\zaxxer
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\com\zaxxer\HikariCP
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\com\zaxxer\HikariCP\2.4.7
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\com\zaxxer\HikariCP\2.7.2
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\com\zaxxer\HikariCP\2.4.7\HikariCP-2.4.7.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\com\zaxxer\HikariCP\2.7.2\HikariCP-2.7.2.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\log4j\log4j
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\log4j\log4j\1.2.17
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\log4j\log4j\1.2.17\log4j-1.2.17.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\logstash\outputs
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\logstash\outputs\jdbc.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-api
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-core
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-slf4j-impl
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-api\2.6.2
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-api\2.9.1
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-api\2.6.2\log4j-api-2.6.2.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-api\2.9.1\log4j-api-2.9.1.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-core\2.9.1
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-core\2.9.1\log4j-core-2.9.1.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-slf4j-impl\2.6.2
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-slf4j-impl\2.9.1
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-slf4j-impl\2.6.2\log4j-slf4j-impl-2.6.2.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\apache\logging\log4j\log4j-slf4j-impl\2.9.1\log4j-slf4j-impl-2.9.1.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-api
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-log4j12
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-api\1.7.21
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-api\1.7.25
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-api\1.7.21\slf4j-api-1.7.21.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-log4j12\1.7.21
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\lib\org\slf4j\slf4j-log4j12\1.7.21\slf4j-log4j12-1.7.21.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec\jdbc_spec_helper.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec\outputs
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec\outputs\jdbc_derby_spec.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec\outputs\jdbc_mysql_spec.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec\outputs\jdbc_postgres_spec.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec\outputs\jdbc_spec.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\spec\outputs\jdbc_sqlite_spec.rb
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\vendor\jar-dependencies
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\vendor\jar-dependencies\runtime-jars
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\vendor\jar-dependencies\runtime-jars\HikariCP-2.7.2.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\vendor\jar-dependencies\runtime-jars\log4j-api-2.6.2.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\vendor\jar-dependencies\runtime-jars\log4j-slf4j-impl-2.6.2.jar
D:\Programs\logstash-7.13.0\vendor\local_gems\0e11c1ff\logstash-output-jdbc-5.4.0\vendor\jar-dependencies\runtime-jars\slf4j-api-1.7.25.jar
文档中提到可以使用prepare-offline-pack参数准备离线安装的插件包,然后再使用 bin/logstash-plugin install进行安装。通过这种方式将本地已安装好的logstash-output-jdbc插件重新打包:
D:\Programs\logstash-7.13.0\bin>logstash-plugin prepare-offline-pack --output D:\Programs\logstash-7.13.0\logstash-output-jdbc.zip logstash-output-jdbc
若重新打包失败,可以直接从logstash-output-jdbc的官方网站下载,官方地址:
https://github.com/theangryangel/logstash-output-jdbc
然后,使用如下命令:
D:\Programs\logstash-7.13.0\bin>logstash-plugin install file://D:/Programs/logstash-output-jdbc.zip
Installing file: /D:/Programs/logstash-output-jdbc.zip
Install successful
D:\Programs\logstash-7.13.0\bin>logstash-plugin list
logstash-codec-avro
logstash-codec-cef
logstash-codec-collectd
logstash-codec-dots
logstash-codec-edn
logstash-codec-edn_lines
logstash-codec-es_bulk
logstash-codec-fluent
logstash-codec-graphite
logstash-codec-json
logstash-codec-json_lines
logstash-codec-line
logstash-codec-msgpack
logstash-codec-multiline
logstash-codec-netflow
logstash-codec-plain
logstash-codec-rubydebug
logstash-filter-aggregate
logstash-filter-anonymize
logstash-filter-cidr
logstash-filter-clone
logstash-filter-csv
logstash-filter-date
logstash-filter-de_dot
logstash-filter-dissect
logstash-filter-dns
logstash-filter-drop
logstash-filter-elasticsearch
logstash-filter-fingerprint
logstash-filter-geoip
logstash-filter-grok
logstash-filter-http
logstash-filter-json
logstash-filter-kv
logstash-filter-memcached
logstash-filter-metrics
logstash-filter-mutate
logstash-filter-prune
logstash-filter-ruby
logstash-filter-sleep
logstash-filter-split
logstash-filter-syslog_pri
logstash-filter-throttle
logstash-filter-translate
logstash-filter-truncate
logstash-filter-urldecode
logstash-filter-useragent
logstash-filter-uuid
logstash-filter-xml
logstash-input-azure_event_hubs
logstash-input-beats
└── logstash-input-elastic_agent (alias)
logstash-input-couchdb_changes
logstash-input-dead_letter_queue
logstash-input-elasticsearch
logstash-input-exec
logstash-input-file
logstash-input-ganglia
logstash-input-gelf
logstash-input-generator
logstash-input-graphite
logstash-input-heartbeat
logstash-input-http
logstash-input-http_poller
logstash-input-imap
logstash-input-jms
logstash-input-pipe
logstash-input-redis
logstash-input-s3
logstash-input-snmp
logstash-input-snmptrap
logstash-input-sqs
logstash-input-stdin
logstash-input-syslog
logstash-input-tcp
logstash-input-twitter
logstash-input-udp
logstash-input-unix
logstash-integration-jdbc
├── logstash-input-jdbc
├── logstash-filter-jdbc_streaming
└── logstash-filter-jdbc_static
logstash-integration-kafka
├── logstash-input-kafka
└── logstash-output-kafka
logstash-integration-rabbitmq
├── logstash-input-rabbitmq
└── logstash-output-rabbitmq
logstash-output-cloudwatch
logstash-output-csv
logstash-output-elastic_app_search
logstash-output-elasticsearch
logstash-output-email
logstash-output-file
logstash-output-graphite
logstash-output-http
logstash-output-jdbc
logstash-output-lumberjack
logstash-output-nagios
logstash-output-null
logstash-output-pipe
logstash-output-redis
logstash-output-s3
logstash-output-sns
logstash-output-sqs
logstash-output-stdout
logstash-output-tcp
logstash-output-udp
logstash-output-webhdfs
logstash-patterns-core
参考文档
Working with plugins
Offline Plugin Management
logstash-output-jdbc插件的在线安装and离线安装
Logstash收集日志数据到MySQL