fluent-plugin-out-upsolver 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 034dcf24e7691bf85a95aeac640e16e3a7b05f0c
4
+ data.tar.gz: 2870566f42b85309ad14f4eaaf1e29afab4b09bb
5
+ SHA512:
6
+ metadata.gz: dd714f4c453b84fc84bfe0234bad8d254961fbe03fc84340f10a0befc279fb87085e82072b85eda2f6de7d0bc6a83319f6a2b9473806a50fff2ba4cd66bfb440
7
+ data.tar.gz: 1c28800c01adb9ae7177decce03dcb492733da28f2567466d4f2a6a12c97660d1538458e0362d00735613b9e4efac4704a744c963caeaaa3342f0974709e76c7
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "rake/testtask"
4
+
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << "lib" << "test"
7
+ test.pattern = "test/**/test_*.rb"
8
+ test.verbose = true
9
+ end
10
+
11
+ namespace :test do
12
+ desc 'Setup test environment'
13
+ task :before do
14
+ $stderr.puts 'Starting server'
15
+
16
+ @web_server = Process.spawn(
17
+ 'script/http_server.rb',
18
+ in: :close,
19
+ out: '/tmp/httpd-out.log',
20
+ err: '/tmp/httpd-err.log'
21
+ )
22
+
23
+ sleep 1
24
+ end
25
+
26
+ desc 'Teardown test environment'
27
+ task :cleanup do
28
+ $stderr.puts 'Stopping server'
29
+ Process.kill 'TERM', @web_server
30
+ end
31
+ end
32
+
33
+ task full_test: ["test:before", "test", "test:cleanup"]
34
+
35
+ task default: :full_test
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "fluent-plugin-out-upsolver"
3
+ s.version = "0.0.1"
4
+ s.licenses = ["MIT"]
5
+ s.summary = "Fluentd out plugin to upsolver"
6
+ s.description = s.summary
7
+ s.authors = ["Shani Elharrar"]
8
+ s.email = ["shani.elha@gmail.com"]
9
+ s.homepage = "https://github.com/Upsolver/fluent-plugin-out-upsolver"
10
+ s.files = `git ls-files`.split("\n")
11
+ s.test_files = `git ls-files -- test/*`.split("\n")
12
+ s.require_paths = ["lib"]
13
+
14
+ s.add_runtime_dependency "fluentd", "~> 0.12"
15
+ s.add_runtime_dependency "curb", "~> 0.9.3"
16
+ s.add_development_dependency "rake", "~> 10.4.2"
17
+ s.add_development_dependency "test-unit", "~> 3.1.3"
18
+ end
@@ -0,0 +1,32 @@
1
+ class Fluent::UpsolverOutput < Fluent::BufferedOutput
2
+ Fluent::Plugin.register_output('upsolver', self)
3
+
4
+ def initialize
5
+ super
6
+ require 'curb'
7
+ end
8
+
9
+ config_param :endpoint_url, :string
10
+
11
+ def configure(conf)
12
+ super
13
+ end
14
+
15
+ def start
16
+ super
17
+ end
18
+
19
+ def end
20
+ super
21
+ end
22
+
23
+ def format(tag, time, record)
24
+ {:tag => tag, :time => time, :record => record }.to_json + "\n"
25
+ end
26
+
27
+ def write(chunk)
28
+ data = chunk.read
29
+ Curl.post(@endpoint_url, data)
30
+ end
31
+
32
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'webrick'
4
+
5
+ server = WEBrick::HTTPServer.new(
6
+ :Port => 12341,
7
+ )
8
+
9
+ server.mount_proc '/' do |req, res|
10
+ print ({:body => req.body})
11
+ res.status = 204
12
+ end
13
+
14
+ server.start
@@ -0,0 +1,42 @@
1
+ require 'test/unit'
2
+ require 'fluent/log'
3
+ require 'fluent/test'
4
+ require 'fluent/plugin/out_upsolver'
5
+
6
+ class UpsolverOutputTest < Test::Unit::TestCase
7
+ include Fluent
8
+
9
+ setup do
10
+ Fluent::Test.setup
11
+ end
12
+
13
+ def create_driver(conf = '')
14
+ Test::BufferedOutputTestDriver.new(UpsolverOutput).configure(conf, true)
15
+ end
16
+
17
+ sub_test_case 'configure' do
18
+ test 'url not exists' do
19
+ conf = ''
20
+ assert_raises(ConfigError) { create_driver(conf) }
21
+ end
22
+ test 'url exist' do
23
+ conf = "endpoint_url http://localhost"
24
+ assert_nothing_raised { create_driver(conf) }
25
+ end
26
+ end
27
+
28
+ sub_test_case 'output' do
29
+ def emit(conf, msg)
30
+ d = create_driver(conf)
31
+ d.emit({'foo' => 'bar', 'message' => msg}, Fluent::Engine.now)
32
+ d.emit({'foo' => 'bar2', 'message' => msg}, Fluent::Engine.now)
33
+ d.run
34
+ end
35
+ test 'execute output' do
36
+ conf = "endpoint_url http://localhost:12341"
37
+ msg = "2015/02/10T01:10:20.123456 INFO GET /ping"
38
+ es = emit(conf, msg)
39
+ # Currently not asserting, will assert once we want to.
40
+ end
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-out-upsolver
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Shani Elharrar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-26 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.12'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: curb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 10.4.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 10.4.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.1.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.3
69
+ description: Fluentd out plugin to upsolver
70
+ email:
71
+ - shani.elha@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Rakefile
79
+ - fluent-plugin-out-upsolver.gemspec
80
+ - lib/fluent/plugin/out_upsolver.rb
81
+ - script/http_server.rb
82
+ - test/plugin/test_out_upsolver.rb
83
+ homepage: https://github.com/Upsolver/fluent-plugin-out-upsolver
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.5.1
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Fluentd out plugin to upsolver
107
+ test_files:
108
+ - test/plugin/test_out_upsolver.rb