fluent-plugin-udp_forward 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 869aa1dd7fb0470798f9f1e06e5483b67d089615
4
- data.tar.gz: d526a38591540ecf4a92823a2b64273ba71b0af1
2
+ SHA256:
3
+ metadata.gz: 8df02cefd91afad6a43cce9ac11ef1036439535e0eff69f45e16392c123cc096
4
+ data.tar.gz: e0322f4ebf144e1145c46a855c3ad06b37b7b668e52843d0fe5970d121dad99e
5
5
  SHA512:
6
- metadata.gz: 76feda844561fc4bceaa280b7d05c7d34c3ddf7a5f9b0e13ca6a07d075f0117bd65de7e194d519a0b9d32b007e02f0a0c8839e780a1288210342aa092eef427b
7
- data.tar.gz: 71837771842de541c4f6b17d3b117a32b949822f36c72d0615de7d87f6d09fd1c8ff747afd3465f51f2d5da3548a50da7d42c1e289f9beb6570d54172234cfc2
6
+ metadata.gz: e85a029e6b19f62b00aa31ec8fa1b665adce42a6161ac0208e519616ba7806048014a107ee22bbc76134bd43c07131ee9a69e69bd5fd7097bd29272b2fd93274
7
+ data.tar.gz: a3b400a11ca880707976dc700e135fc434c2c425411359c139887c05cf14fce90ff9b37f732ea54b87da2cd50e5382b90b030d06d5b37b6ebd0987a995fcca6a
data/.gitignore CHANGED
@@ -1,50 +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
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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 tombola Ltd
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 tombola Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,66 +1,66 @@
1
- [<img src="https://badge.fury.io/rb/fluent-plugin-udp_forward.png" alt="Gem Version" />](http://badge.fury.io/rb/fluent-plugin-udp_forward)
2
- # fluent-plugin-udp_forward
3
-
4
- #### Overview
5
-
6
- This fluent input plugin allows you to collect incoming events over UDP.
7
- While fluentd's default UDP Input plugin supports adding a tag to the received message statically by configuration,
8
- it does not support extracting a tag from the received message.
9
- This plugin supports extracting the tag from incoming events over UDP. UDP events should be in JSON format.
10
-
11
- #### Installation
12
-
13
- gem install fluent-plugin-udp_forward
14
-
15
- #### Configuration
16
-
17
- <source>
18
- @type udp_forward
19
- bind "localhost"
20
- port 5160
21
- tag_key "tag"
22
- message_key "data"
23
- </source>
24
-
25
- Optional parameters are as follows:
26
-
27
- - bind: The bind address to listen to. Default is "0.0.0.0
28
- - port: The port to listen to. Default is 5160
29
- - tag_key: Name of tag key. Default is "tag"
30
- - message_key: Name of message key. Default is "data"
31
-
32
- #### Example
33
- If your fluentd source configuration is the same as above and you submitting an event like this:
34
-
35
- require "socket"
36
- require 'json'
37
-
38
- my_hash = {tag: 'my_tag', data:{ "level": "INFO", "time": Time.now, "message": "Yayyy!!" }}
39
- UDPSocket.new.send(JSON.generate(my_hash), 0, 'localhost', 5160)
40
-
41
- The output will be:
42
-
43
- 2019-02-26 11:11:03.499991000 +0000 my_tag: {"level":"INFO","time":"2019-02-26 11:11:03 +0000","message":"Yayyy!!"}
44
-
45
-
46
- ## Requirements
47
-
48
- | fluent-plugin-udp_forward | fluentd |
49
- |-------------------|---------|
50
- | >= 1.0.0 | >= v0.12.0 < 2 |
51
-
52
- #### Contributing
53
-
54
- 1. Fork it ( http://github.com/tombolaltd/fluent-plugin-udp_forward/fork )
55
- 2. Create your feature branch (`git checkout -b my-new-feature`)
56
- 3. Commit your changes (`git commit -am 'Add some feature'`)
57
- 4. Push to the branch (`git push origin my-new-feature`)
58
- 5. Create a new Pull Request
59
-
60
- #### Copyright
61
-
62
- Copyright (c) 2019 - [tombola](https://www.tombolaarcade.co.uk).
63
-
64
- #### License
65
-
66
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
1
+ [<img src="https://badge.fury.io/rb/fluent-plugin-udp_forward.png" alt="Gem Version" />](http://badge.fury.io/rb/fluent-plugin-udp_forward)
2
+ # fluent-plugin-udp_forward
3
+
4
+ #### Overview
5
+
6
+ This fluent input plugin allows you to collect incoming events over UDP.
7
+ While fluentd's default UDP Input plugin supports adding a tag to the received message statically by configuration,
8
+ it does not support extracting a tag from the received message.
9
+ This plugin supports extracting the tag from incoming events over UDP. UDP events should be in JSON format.
10
+
11
+ #### Installation
12
+
13
+ gem install fluent-plugin-udp_forward
14
+
15
+ #### Configuration
16
+
17
+ <source>
18
+ @type udp_forward
19
+ bind "localhost"
20
+ port 5160
21
+ tag_key "tag"
22
+ message_key "data"
23
+ </source>
24
+
25
+ Optional parameters are as follows:
26
+
27
+ - bind: The bind address to listen to. Default is "0.0.0.0
28
+ - port: The port to listen to. Default is 5160
29
+ - tag_key: Name of tag key. Default is "tag"
30
+ - message_key: Name of message key. Default is "data"
31
+
32
+ #### Example
33
+ If your fluentd source configuration is the same as above and you submitting an event like this:
34
+
35
+ require "socket"
36
+ require 'json'
37
+
38
+ my_hash = {tag: 'my_tag', data:{ "level": "INFO", "time": Time.now, "message": "Yayyy!!" }}
39
+ UDPSocket.new.send(JSON.generate(my_hash), 0, 'localhost', 5160)
40
+
41
+ The output will be:
42
+
43
+ 2019-02-26 11:11:03.499991000 +0000 my_tag: {"level":"INFO","time":"2019-02-26 11:11:03 +0000","message":"Yayyy!!"}
44
+
45
+
46
+ ## Requirements
47
+
48
+ | fluent-plugin-udp_forward | fluentd |
49
+ |-------------------|---------|
50
+ | >= 1.0.0 | >= v0.12.0 < 2 |
51
+
52
+ #### Contributing
53
+
54
+ 1. Fork it ( http://github.com/tombolaltd/fluent-plugin-udp_forward/fork )
55
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
56
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
57
+ 4. Push to the branch (`git push origin my-new-feature`)
58
+ 5. Create a new Pull Request
59
+
60
+ #### Copyright
61
+
62
+ Copyright (c) 2019 - [tombola](https://www.tombolaarcade.co.uk).
63
+
64
+ #### License
65
+
66
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,17 +1,18 @@
1
- # encoding: utf-8
2
- Gem::Specification.new do |gem|
3
- gem.name = "fluent-plugin-udp_forward"
4
- gem.description = "This input plugin allows you to collect incoming events over UDP"
5
- gem.homepage = "https://github.com/tombolaltd/fluent-plugin-udp_forward"
6
- gem.summary = gem.description
7
- gem.version = "1.0.1"
8
- gem.license = 'MIT'
9
- gem.authors = ["Sohaib Maroof"]
10
- gem.email = "sohaib.maroof@tombola.com"
11
- gem.has_rdoc = false
12
- gem.files = `git ls-files`.split("\n")
13
- gem.require_paths = ['lib']
14
- gem.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
15
- end
16
-
17
-
1
+ # encoding: utf-8
2
+ Gem::Specification.new do |gem|
3
+ gem.name = "fluent-plugin-udp_forward"
4
+ gem.description = "This input plugin allows you to collect incoming events over UDP"
5
+ gem.homepage = "https://github.com/tombolaltd/fluent-plugin-udp_forward"
6
+ gem.summary = gem.description
7
+ gem.version = "1.0.2"
8
+ gem.license = 'MIT'
9
+ gem.authors = ["Sohaib Maroof"]
10
+ gem.email = "sohaib.maroof@tombola.com"
11
+ gem.has_rdoc = false
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.require_paths = ['lib']
14
+ gem.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
15
+ gem.required_ruby_version = '>= 2.1'
16
+ end
17
+
18
+
@@ -1,63 +1,63 @@
1
- require 'fluent/input'
2
- module Fluent
3
- class UDPForwardInput < Input
4
-
5
- Fluent::Plugin.register_input('udp_forward', self)
6
- require 'socket'
7
-
8
- config_param :port, :integer, :default => 5160
9
- config_param :bind, :string, :default => '0.0.0.0'
10
- config_param :tag_key, :string, :default => 'tag'
11
- config_param :message_key, :string, :default => 'data'
12
-
13
- def configure(conf)
14
- super
15
- end
16
-
17
- def start
18
- super
19
-
20
- $log.info("udp_forward listening on #{@bind}:#{@port}")
21
-
22
- @thread = Thread.new(Thread.current) do |parent|
23
- while (true)
24
- begin
25
- Socket.udp_server_loop(@bind, @port) do |msg, msg_src|
26
- tag, time, record = parse(msg)
27
- router.emit(tag, time, record)
28
- end
29
- rescue
30
- $log.error("unexpected error in udp_server_loop", :error=>$!.to_s)
31
- $log.error_backtrace
32
- end
33
- end
34
- end
35
- end
36
-
37
- def shutdown
38
- super
39
- @thread.kill
40
- end
41
-
42
- private
43
-
44
- def parse(message)
45
- begin
46
- parsed = JSON.parse(message)
47
- rescue
48
- $log.warn("Parse error : #{message} \n #{$!.to_s}")
49
- parsed = {}
50
- end
51
-
52
- time = Engine.now
53
- tag = parsed[@tag_key]
54
- record = parsed[@message_key]
55
-
56
- if(tag.nil? || record.nil?)
57
- $log.warn("invalid message supplied: #{message}")
58
- end
59
-
60
- return [tag, time, record]
61
- end
62
- end
63
- end
1
+ require 'fluent/input'
2
+ module Fluent
3
+ class UDPForwardInput < Input
4
+
5
+ Fluent::Plugin.register_input('udp_forward', self)
6
+ require 'socket'
7
+
8
+ config_param :port, :integer, :default => 5160
9
+ config_param :bind, :string, :default => '0.0.0.0'
10
+ config_param :tag_key, :string, :default => 'tag'
11
+ config_param :message_key, :string, :default => 'data'
12
+
13
+ def configure(conf)
14
+ super
15
+ end
16
+
17
+ def start
18
+ super
19
+
20
+ $log.info("udp_forward listening on #{@bind}:#{@port}")
21
+
22
+ @thread = Thread.new(Thread.current) do |parent|
23
+ while (true)
24
+ begin
25
+ Socket.udp_server_loop(@bind, @port) do |msg, msg_src|
26
+ tag, time, record = parse(msg)
27
+ router.emit(tag, time, record)
28
+ end
29
+ rescue
30
+ $log.error("unexpected error in udp_server_loop", :error=>$!.to_s)
31
+ $log.error_backtrace
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ def shutdown
38
+ super
39
+ @thread.kill
40
+ end
41
+
42
+ private
43
+
44
+ def parse(message)
45
+ begin
46
+ parsed = JSON.parse(message)
47
+ rescue
48
+ $log.warn("Parse error : #{message} \n #{$!.to_s}")
49
+ parsed = {}
50
+ end
51
+
52
+ time = Engine.now
53
+ tag = parsed[@tag_key]
54
+ record = parsed[@message_key]
55
+
56
+ if(tag.nil? || record.nil?)
57
+ $log.warn("invalid message supplied: #{message}")
58
+ end
59
+
60
+ return [tag, time, record]
61
+ end
62
+ end
63
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-udp_forward
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sohaib Maroof
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-15 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: '0'
56
+ version: '2.1'
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  requirements: []
63
63
  rubyforge_project:
64
- rubygems_version: 2.5.2.3
64
+ rubygems_version: 2.7.6
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: This input plugin allows you to collect incoming events over UDP