fluent-plugin-rambler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f90b47a98fbfbd1219a038386fce480f3836b00e
4
+ data.tar.gz: 4259f77bcaadd36dbac838a0aac26e4c6a0146ff
5
+ SHA512:
6
+ metadata.gz: e1d5067fdf5627fbb8b514e9be3c088dd41a3500d5287d15e103b2b14c0fbf78d0d2f0c506958ce65fa9e29496f979bb4a50a071457bb0239b3d429805a09770
7
+ data.tar.gz: f5b43dc577301b817fdf6decce17e7bdb667c71b1bff6cce185b27d00e20a345725a83239c19da81f2d591f59a876915df264e4875773fbac84ab74ed7e31723
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-rambler.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (C) 2013 Keisuke Nishida
2
+
3
+ Licensed to the Apache Software Foundation (ASF) under one
4
+ or more contributor license agreements. See the NOTICE file
5
+ distributed with this work for additional information
6
+ regarding copyright ownership. The ASF licenses this file
7
+ to you under the Apache License, Version 2.0 (the
8
+ "License"); you may not use this file except in compliance
9
+ with the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing,
14
+ software distributed under the License is distributed on an
15
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ KIND, either express or implied. See the License for the
17
+ specific language governing permissions and limitations
18
+ under the License.
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Fluent::Plugin::Rambler
2
+
3
+ A variant of S3 output plugin for Amazon Redshift.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'fluent-plugin-rambler'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install fluent-plugin-rambler
18
+
19
+ ## Configuration
20
+
21
+ Since RamblerOutput is a subclass of S3Output, most configuration parameters
22
+ are inherited from out_s3.
23
+
24
+ http://docs.fluentd.org/articles/out_s3
25
+
26
+ There are additional parameters specific to out_rambler:
27
+
28
+ <match **>
29
+ type rambler
30
+
31
+ # for fluent-plugin-s3
32
+
33
+ aws_key_id YOUR_AWS_KEY_ID
34
+ aws_sec_key YOUR_AWS_SECRET/KEY
35
+ s3_bucket YOUR_S3_BUCKET_NAME
36
+ s3_endpoint s3-ap-northeast-1.amazonaws.com
37
+
38
+ # NOTE: don't forget to put '/' after %{time_slice}.
39
+ s3_object_key_format %{path}%{time_slice}/%{hostname}-%{index}.%{file_extension}
40
+
41
+ # remote path in the convension of Rambler time-series tables
42
+ path redshift/DATABASE/TABLE/%Y%m/
43
+ buffer_path /var/log/fluent/DATABASE.TABLE
44
+
45
+ # the buffer will be flushed with this time slice
46
+ time_slice_format %Y%m%d
47
+ time_slice_wait 10m
48
+ utc
49
+
50
+ # The default value corresponds to Redshift's default timestamp: YYYY-MM-DD HH:MI:SS
51
+ #time_format %Y-%m-%d %H:%M:%S
52
+
53
+ # for Rambler
54
+
55
+ columns %{time}|key1|key2|...
56
+ </match>
57
+
58
+ ## Contributing
59
+
60
+ 1. Fork it
61
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 4. Push to the branch (`git push origin my-new-feature`)
64
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rake/testtask'
4
+ Rake::TestTask.new(:test) do |test|
5
+ test.libs << 'lib' << 'test'
6
+ test.pattern = 'test/**/test_*.rb'
7
+ test.verbose = true
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "fluent-plugin-rambler"
6
+ gem.version = "0.1.0"
7
+ gem.authors = ["Keisuke Nishida"]
8
+ gem.email = ["keisuke.nishida@gmail.com"]
9
+ gem.summary = %q{Splunk output plugin (REST API / Storm API) for Fluent event collector}
10
+ gem.description = %q{Splunk output plugin for Fluent event collector. This plugin supports Splunk REST API and Splunk Storm API.}
11
+ gem.homepage = "https://github.com/k24d/fluent-plugin-rambler"
12
+ gem.license = 'Apache License, Version 2.0'
13
+
14
+ gem.files = `git ls-files`.split($/)
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.rubyforge_project = "fluent-plugin-rambler"
20
+ gem.add_development_dependency "fluentd"
21
+ gem.add_development_dependency "fluent-plugin-s3"
22
+ gem.add_runtime_dependency "fluentd"
23
+ gem.add_runtime_dependency "fluent-plugin-s3"
24
+ end
@@ -0,0 +1,69 @@
1
+ =begin
2
+
3
+ Copyright (C) 2013 Keisuke Nishida
4
+
5
+ Licensed to the Apache Software Foundation (ASF) under one
6
+ or more contributor license agreements. See the NOTICE file
7
+ distributed with this work for additional information
8
+ regarding copyright ownership. The ASF licenses this file
9
+ to you under the Apache License, Version 2.0 (the
10
+ "License"); you may not use this file except in compliance
11
+ with the License. You may obtain a copy of the License at
12
+
13
+ http://www.apache.org/licenses/LICENSE-2.0
14
+
15
+ Unless required by applicable law or agreed to in writing,
16
+ software distributed under the License is distributed on an
17
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ KIND, either express or implied. See the License for the
19
+ specific language governing permissions and limitations
20
+ under the License.
21
+
22
+ =end
23
+
24
+ require 'fluent/plugin/out_s3'
25
+
26
+ module Fluent
27
+
28
+ class RamblerOutput < S3Output
29
+ Plugin.register_output('rambler', self)
30
+
31
+ config_param :columns, :string, :default => '%{time}'
32
+ config_param :time_format, :string, :default => '%Y-%m-%d %H:%M:%S'
33
+ config_param :s3_object_key_format, :string, :default => '%{path}%{time_slice}/%{index}.%{file_extension}'
34
+
35
+ def initialize
36
+ super
37
+ end
38
+
39
+ def configure(conf)
40
+ super
41
+
42
+ unless ['gzip', 'txt'].include? @store_as
43
+ raise ConfigError, "only 'gzip' or 'txt' is allowed for store_as: #{@store_as}"
44
+ end
45
+
46
+ @separator = '|'
47
+ @columns = @columns.split(@separator)
48
+ end
49
+
50
+ def format(tag, time, record)
51
+ super
52
+
53
+ @columns.map {|name|
54
+ if name == '%{time}'
55
+ # timestamp
56
+ if @localtime
57
+ Time.at(time).strftime(@time_format)
58
+ else
59
+ Time.at(time).utc.strftime(@time_format)
60
+ end
61
+ else
62
+ # record value
63
+ record[name].to_s
64
+ end
65
+ }.join(@separator) + "\n"
66
+ end
67
+ end
68
+
69
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+
12
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
13
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
14
+ require 'fluent/test'
15
+ unless ENV.has_key?('VERBOSE')
16
+ nulllogger = Object.new
17
+ nulllogger.instance_eval {|obj|
18
+ def method_missing(method, *args)
19
+ # pass
20
+ end
21
+ }
22
+ $log = nulllogger
23
+ end
24
+
25
+ require 'fluent/plugin/out_rambler'
26
+
27
+ class Test::Unit::TestCase
28
+ end
@@ -0,0 +1,29 @@
1
+ require 'helper'
2
+
3
+ class RamblerOutputTest < Test::Unit::TestCase
4
+ def setup
5
+ Fluent::Test.setup
6
+ end
7
+
8
+ CONFIG = %[
9
+ ]
10
+
11
+ def create_driver(conf=CONFIG, tag='test')
12
+ Fluent::Test::BufferedOutputTestDriver.new(Fluent::RamblerOutput, tag).configure(conf)
13
+ end
14
+
15
+ def test_configure
16
+ # default
17
+ d = create_driver
18
+ end
19
+
20
+ def test_write
21
+ d = create_driver
22
+
23
+ time = Time.parse("2010-01-02 13:14:15 UTC").to_i
24
+ d.emit({"a"=>1}, time)
25
+ d.emit({"a"=>2}, time)
26
+
27
+ d.run
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-rambler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Keisuke Nishida
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fluentd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fluent-plugin-s3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: fluentd
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fluent-plugin-s3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Splunk output plugin for Fluent event collector. This plugin supports
70
+ Splunk REST API and Splunk Storm API.
71
+ email:
72
+ - keisuke.nishida@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - fluent-plugin-rambler.gemspec
83
+ - lib/fluent/plugin/out_rambler.rb
84
+ - test/helper.rb
85
+ - test/plugin/test_out_rambler.rb
86
+ homepage: https://github.com/k24d/fluent-plugin-rambler
87
+ licenses:
88
+ - Apache License, Version 2.0
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project: fluent-plugin-rambler
106
+ rubygems_version: 2.0.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Splunk output plugin (REST API / Storm API) for Fluent event collector
110
+ test_files:
111
+ - test/helper.rb
112
+ - test/plugin/test_out_rambler.rb