Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
132 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
+{ | ||
ruby => { | ||
ll_path => '$LLENV_ROOT/lls/$LLENV_OSTYPE/ruby/versions/1.9.2-p290/bin/ruby', | ||
bundle_lib => '$LLENV_ROOT/apps/fluent-plugin-aggregate-filter/vendor/bundle/ruby/1.9.1', | ||
bundle_path => '$LLENV_ROOT/apps/fluent-plugin-aggregate-filter/vendor/bundle/ruby/1.9.1/bin', | ||
app_lib => '$LLENV_ROOT/apps/fluent-plugin-aggregate-filter/lib', | ||
app_path => '$LLENV_ROOT/apps/fluent-plugin-aggregate-filter/bin', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ group :development do | |
end | ||
|
||
#gem "fluentd", :path => 'vendor/fluentd' if RUBY_VERSION >= "1.9.2" | ||
gem "fluentd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class Fluent::AggregationFilter < Fluent::TimeSlicedOutput | ||
Fluent::Plugin.register_output('aggregation_filter', self) | ||
|
||
include Fluent::SetTagKeyMixin | ||
config_set_default :include_tag_key, false | ||
|
||
include Fluent::SetTimeKeyMixin | ||
config_set_default :include_time_key, true | ||
|
||
# config_param :hoge, :string, :default => 'hoge' | ||
|
||
def initialize | ||
super | ||
# require 'hogepos' | ||
end | ||
|
||
def configure(conf) | ||
super | ||
# @path = conf['path'] | ||
end | ||
|
||
def start | ||
super | ||
# init | ||
end | ||
|
||
def shutdown | ||
super | ||
# destroy | ||
end | ||
|
||
def format(tag, time, record) | ||
[tag, time, record].to_msgpack | ||
end | ||
|
||
def write(chunk) | ||
records = [] | ||
chunk.msgpack_each { |record| | ||
# records << record | ||
} | ||
# write records | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,68 @@ | ||
require 'helper' | ||
# require 'time' | ||
|
||
class TestFluentPluginAggregateFilter < Test::Unit::TestCase | ||
should "probably rename this file and start testing for real" do | ||
flunk "hey buddy, you should probably rename this file and start testing for real" | ||
class AggregationFilterTest < Test::Unit::TestCase | ||
TMP_DIR = File.dirname(__FILE__) + "/../tmp" | ||
|
||
def setup | ||
Fluent::Test.setup | ||
FileUtils.rm_rf(TMP_DIR) | ||
FileUtils.mkdir_p(TMP_DIR) | ||
end | ||
|
||
CONFIG = %[ | ||
buffer_path #{TMP_DIR}/buffer | ||
] | ||
# CONFIG = %[ | ||
# path #{TMP_DIR}/out_file_test | ||
# compress gz | ||
# utc | ||
# ] | ||
|
||
def create_driver(conf = CONFIG) | ||
Fluent::Test::TimeSlicedOutputTestDriver.new(Fluent::AggregationFilter).configure(conf) | ||
end | ||
|
||
def test_configure | ||
#### set configurations | ||
# d = create_driver %[ | ||
# path test_path | ||
# compress gz | ||
# ] | ||
#### check configurations | ||
# assert_equal 'test_path', d.instance.path | ||
# assert_equal :gz, d.instance.compress | ||
end | ||
|
||
def test_format | ||
d = create_driver | ||
|
||
# time = Time.parse("2011-01-02 13:14:15 UTC").to_i | ||
# d.emit({"a"=>1}, time) | ||
# d.emit({"a"=>2}, time) | ||
|
||
# d.expect_format %[2011-01-02T13:14:15Z\ttest\t{"a":1}\n] | ||
# d.expect_format %[2011-01-02T13:14:15Z\ttest\t{"a":2}\n] | ||
|
||
# d.run | ||
end | ||
|
||
def test_write | ||
d = create_driver | ||
|
||
# time = Time.parse("2011-01-02 13:14:15 UTC").to_i | ||
# d.emit({"a"=>1}, time) | ||
# d.emit({"a"=>2}, time) | ||
|
||
# ### FileOutput#write returns path | ||
# path = d.run | ||
# expect_path = "#{TMP_DIR}/out_file_test._0.log.gz" | ||
# assert_equal expect_path, path | ||
|
||
# data = Zlib::GzipReader.open(expect_path) {|f| f.read } | ||
# assert_equal %[2011-01-02T13:14:15Z\ttest\t{"a":1}\n] + | ||
# %[2011-01-02T13:14:15Z\ttest\t{"a":2}\n], | ||
# data | ||
end | ||
end | ||
|