fluent-plugin-avro 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db400c003d5b29d2875663497bd15fd3f0493aed
4
- data.tar.gz: 0dbcd6b77f7ef88a945452c68ae4cf62ab9cab6b
3
+ metadata.gz: 8ba36dddb8462493270ebc6b5168e52ae47ccddb
4
+ data.tar.gz: 93a4a16e79b74b3259656df8c728c5335f09c40f
5
5
  SHA512:
6
- metadata.gz: aa7e5d1a596f65c9663c03536e4a14092c6741dc91382c070cc697757579aca0579c5fecb6fe7482ea42a34df7d5a0610f87361cf28bfa3383507fef546004ad
7
- data.tar.gz: a58ca2b02b7b321513c84d2c13dd05d5d90855864765112f337534ab3d3be5fe79d633ebb19766d06e1110cd9cd37ecc4fec46de26d2c6b359f1395f6c62594a
6
+ metadata.gz: 2ca3f2caa9ae8409bc0a3115e081f6ac74493cff06492bd8031983c76c233e3b11334aff82f371549ce3beedf640592a1b7b2df535f5726b7dd3e5bc853ae974
7
+ data.tar.gz: de6c798bb18e897efd8c2bb77e21651ce1b47c0250cacb841530213ae8928da9deffaa90ceff31fa6adaf902604feec3ec2131251af963a5553db7c9cb6f0b3d
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # fluent-plugin-avro
2
+
3
+ fluent-plugin-avro provides a formatter plugin for Fluentd.
4
+
5
+ ## Configurations
6
+
7
+ | Name | Description |
8
+ | ---- | ----------- |
9
+ | `schema_file` | filename of Avro schema |
10
+ | `schema_json` | JSON representation of Avro schema |
11
+
12
+ ### Example
13
+
14
+ ```
15
+ <match example.avro>
16
+ type file
17
+ path /path/to/output
18
+ format avro
19
+
20
+ schema_file /path/to/schema.avsc
21
+
22
+ ## You can use schema_json instead of schema_file
23
+ # schema_json {"type":"record","name":"example","namespace":"org.example","fields":[{"name":"message","type":"string"}]}
24
+ </match>
25
+ ```
26
+
27
+ ## License
28
+
29
+ Apache License, Version 2.0.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-avro"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2"
8
8
  spec.authors = ["Shun Takebayashi"]
9
9
  spec.email = ["shun@takebayashi.asia"]
10
10
 
@@ -5,11 +5,18 @@ module Fluent
5
5
  class AvroFormatter < Formatter
6
6
  Fluent::Plugin.register_formatter('avro', self)
7
7
 
8
- config_param :schema_file, :string
8
+ config_param :schema_file, :string, :default => nil
9
+ config_param :schema_json, :string, :default => nil
9
10
 
10
11
  def configure(conf)
11
12
  super
12
- @schema = Avro::Schema.parse(File.read(@schema_file))
13
+ if not (@schema_json.nil? ^ @schema_file.nil?) then
14
+ raise Fluent::ConfigError, 'schema_json or schema_file (but not both) is required'
15
+ end
16
+ if @schema_json.nil? then
17
+ @schema_json = File.read(@schema_file)
18
+ end
19
+ @schema = Avro::Schema.parse(@schema_json)
13
20
  end
14
21
 
15
22
  def format(tag, time, record)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-avro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shun Takebayashi
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - Gemfile
78
78
  - LICENSE.txt
79
+ - README.md
79
80
  - Rakefile
80
81
  - fluent-plugin-avro.gemspec
81
82
  - lib/fluent/plugin/formatter_avro.rb