fluent-plugin-http-enhanced 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,29 @@
1
+ = Enhanced HTTP input plugin for Fluent event collector
2
+
3
+ == Overview
4
+
5
+ This plugin enables some advanced features on existing HTTP input plugin
6
+
7
+ == Installation
8
+
9
+ gem install fluent-plugin-http-enhanced
10
+
11
+ == Configuration
12
+
13
+ <source>
14
+ type httpenhanced
15
+ port <port_to_listen>
16
+ full_query_string_record <true/false> # this will allow request like http://host:port/tag?key1=value1&key2=value2 to be translated to json.
17
+ respond_with_empty_img <true/false> # this will respond with empty gif image of 1x1 pixel. Its usefull when you use image tags to fire events (like Google Analytics)
18
+ default_tag viki # this tag will be used if your request has no tag in it eg. http://host:port/?key1=value1&key2=value2
19
+ </source>
20
+
21
+
22
+ == Copyright
23
+
24
+ Copyright:: Copyright (c) 2011 Abhishek Parolkar
25
+ License:: Apache License, Version 2.0
26
+
27
+
28
+
29
+
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "fluent-plugin-http-enhanced"
5
+ gem.description = "Enhanced HTTP input plugin for Fluent event collector"
6
+ gem.homepage = "https://github.com/parolkar/fluent-plugin-http-enhanced"
7
+ gem.summary = gem.description
8
+ gem.version = "0.0.1"
9
+ gem.authors = ["Abhishek Parolkar"]
10
+ gem.email = "abhishek@parolkar.com"
11
+ gem.has_rdoc = false
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ gem.require_paths = ['lib']
16
+ gem.add_dependency "fluentd", "~> 0.10.8"
17
+ end
18
+
19
+
@@ -0,0 +1,40 @@
1
+ module Fluent
2
+ class HttpEnhanced < Fluent::HttpInput
3
+ Plugin.register_input('httpenhanced', self)
4
+
5
+ config_param :full_query_string_record, :bool, :default => 'false'
6
+ config_param :respond_with_empty_img, :bool, :default => 'false'
7
+ config_param :default_tag, :default => ''
8
+
9
+ def on_request(path_info, params)
10
+ if @full_query_string_record == true
11
+ begin
12
+ path = path_info[1..-1] # remove /
13
+ tag = path.split('/').join('.')
14
+ tag = @default_tag if tag == '' && @default_tag != ''
15
+ record = params
16
+ time = params['time']
17
+ time = time.to_i
18
+ if time == 0
19
+ time = Engine.now
20
+ end
21
+ rescue
22
+ return ["400 Bad Request", {'Content-type'=>'text/plain'}, "400 Bad Request\n#{$!}\n"]
23
+ end
24
+ begin
25
+ Engine.emit(tag, time, record)
26
+ rescue
27
+ return ["500 Internal Server Error", {'Content-type'=>'text/plain'}, "500 Internal Server Error\n#{$!}\n"]
28
+ end
29
+
30
+ if @respond_with_empty_img == true
31
+ return ["200 OK", {'Content-type'=>'image/gif'}, "GIF89a\u0001\u0000\u0001\u0000\x80\xFF\u0000\xFF\xFF\xFF\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0002\u0002D\u0001\u0000;"]
32
+ else
33
+ return ["200 OK", {'Content-type'=>'text/plain'}, ""]
34
+ end
35
+ else
36
+ super(path_info, params)
37
+ end
38
+ end
39
+ end
40
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-http-enhanced
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Abhishek Parolkar
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-12-07 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: fluentd
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 0.10.8
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: Enhanced HTTP input plugin for Fluent event collector
27
+ email: abhishek@parolkar.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - README.rdoc
36
+ - fluent-plugin-http-enhanced.gemspec
37
+ - lib/fluent/plugin/in_httpenhanced.rb
38
+ homepage: https://github.com/parolkar/fluent-plugin-http-enhanced
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.8.10
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: Enhanced HTTP input plugin for Fluent event collector
65
+ test_files: []
66
+