Giter Club home page Giter Club logo

logstash-input-alioss's Introduction

Logstash input plugin base on aliyun/oss

安装使用 jruby

rvm install jruby-9.1.7.0
rvm use jruby-9.1.7.0 --default

安装 bundler

gem install bundler

创建项目

用工具生成项目模板

logstash-plugin generate --type input --name alioss --path ./

当前目录下创建了一个名为 logstash-input-alioss 的工程,目录结构如下:

|____CHANGELOG.md
|____CONTRIBUTORS
|____DEVELOPER.md
|____Gemfile
|____Gemfile.lock
|____lib
| |____logstash
| | |____inputs
| | | |____alioss.rb
|____LICENSE
|____logstash-input-alioss.gemspec
|____Rakefile
|____README.md
|____spec
| |____inputs
| | |____alioss_spec.rb

安装依赖

使用 gem 安装 aliyun-sdksnappy 。注意: aliyun-sdk 并未使用最新版本,而是使用 0.3.6, 详情戳这里 issue

gem install -v 0.3.6 aliyun-sdk
gem install snappy

集成 aliyun-sdk

编辑 logstash-input-alioss.gemspec,添加依赖

s.add_runtime_dependency 'aliyun-sdk', '~> 0.3.6'
s.add_runtime_dependency 'snappy'

打包工程

bundle install

安装插件

安装插件可以分成两种,开发模式、生产模式。参考这里

1. 开发模式

修改 logstash/Gemfile

echo 'gem "logstash-input-alioss", :path => "logstash-input-alioss绝对路径"' >> logstash路径/Gemfile

命令行安装

logstash-plugin install --no-verify

2. 生产模式

执行下面命令,会在工程下生成 logstash-input-alioss-0.1.0.gem 文件

gem build logstash-input-alioss.gemspec

命令行安装 (别急,这个过程可能会需要多等一会)

logstash-plugin install /path/to/logstash-input-alioss-0.1.0.gem

3. 检查插件是否安装成功

不论以上哪种方法,安装成功的话都会出现在列表中

logstash-plugin list --group input

编写配置文件

alioss.logstash.conf

input {
    alioss {
        endpoint => 'your endpoint'
        access_key_id => 'your access_key_id'
        access_key_secret => 'your access_key_secret'
        bucket => 'your bucket'
        interval => 60
        codec => json
    }
}

output {
    stdout {
        codec=>rubydebug
    }
}

测试插件

logstash -f alioss.logstash.conf

logstash-input-alioss's People

Contributors

oksep avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.