fluent-plugin-remote_syslog_tcp 0.3.3

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: c5a6a3f822746ddb454e78ec29b75c0243735819
4
+ data.tar.gz: df4467f2577e01af207e4b7d7361bf1aa0a5a82a
5
+ SHA512:
6
+ metadata.gz: 68db015c4ef2415af2f05176b4cb1b13916c3983d16c907a908448a103cf8b6e1a188a086d7621b1170616548f54798bbb3f4390ebd463b1654b4bae19e8d0b1
7
+ data.tar.gz: 8c9e52e9e44dc5dfd145842ad546b0f23c70176ab0a90957ae363c0e32be60a89f0c27d40aae75416b2f5251816449923e6499354aae0e047cd5ff4164b46e90
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ rvm:
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
8
+ - 2.4.1
9
+ before_install:
10
+ - gem update bundler
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ ## 0.3.3
2
+
3
+ * Allow override "severity" or "facility" from records [#19](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/19)
4
+ * Change default port to 514 [#15](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/15)
5
+
6
+ ## 0.3.2
7
+
8
+ * Rewrite plugin to make rewrite tag function work properly [#4](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/4)
9
+
10
+ ## 0.3.1
11
+
12
+ * Fix errors in last release [#3](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/3)
13
+
14
+ ## 0.3.0 (yanked)
15
+
16
+ * Integrate with `Fluent::Mixin::RewriteTagName` [#2](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/2)
17
+
18
+ ## 0.2.1
19
+
20
+ * Fix encoding issue
21
+
22
+ ## 0.2.0
23
+
24
+ * Integrate with `Fluent::Mixin::PlainTextFormatter`
25
+ * **BREAKING**: Remove `key_name` config, use `output_data_type` instead
26
+
27
+ ## 0.1.0
28
+
29
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-remote_syslog.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Richard Lee
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # fluent-plugin-remote_syslog
2
+
3
+ [![Build Status](https://travis-ci.org/dlackty/fluent-plugin-remote_syslog.svg?branch=master)](https://travis-ci.org/dlackty/fluent-plugin-remote_syslog)
4
+
5
+ [Fluentd](http://fluentd.org) plugin for output to remote syslog serivce (e.g. [Papertrail](http://papertrailapp.com/))
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ fluent-gem install fluent-plugin-remote_syslog
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ <match foo>
17
+ type remote_syslog
18
+ host example.com
19
+ port 514
20
+ severity debug
21
+ tag fluentd
22
+ </match>
23
+ ```
24
+
25
+ This plugin makes use of [Fluent::Mixin::PlainTextFormatter](https://github.com/tagomoris/fluent-mixin-plaintextformatter) and [Fluent::Mixin::RewriteTagName](https://github.com/y-ken/fluent-mixin-rewrite-tag-name), please check out their documentations for more configuration options.
26
+
27
+ ## License
28
+
29
+ Copyright (c) 2014-2017 Richard Lee. See LICENSE for details.
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/plugin/*.rb"
7
+ test.verbose = true
8
+ end
9
+
10
+ task :default => :test
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.3
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "fluent-plugin-remote_syslog_tcp"
7
+ spec.version = File.read("VERSION").strip
8
+ spec.authors = ["Richard Lee"]
9
+ spec.email = ["dlackty@gmail.com"]
10
+ spec.summary = %q{Fluentd output plugin for remote syslog}
11
+ spec.description = spec.description
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_development_dependency "rake", "~> 10.0"
19
+ spec.add_development_dependency "test-unit-minitest"
20
+ spec.add_development_dependency "minitest"
21
+
22
+ spec.add_runtime_dependency "fluentd"
23
+ spec.add_runtime_dependency "fluent-mixin-plaintextformatter"
24
+ spec.add_runtime_dependency "remote_syslog_logger_custom"
25
+ spec.add_runtime_dependency "fluent-mixin-config-placeholders"
26
+ spec.add_runtime_dependency "fluent-mixin-rewrite-tag-name"
27
+ end
@@ -0,0 +1,55 @@
1
+ require "fluent/mixin/config_placeholders"
2
+ require "fluent/mixin/plaintextformatter"
3
+ require 'fluent/mixin/rewrite_tag_name'
4
+
5
+ module Fluent
6
+ class RemoteSyslogTcpOutput < Fluent::Output
7
+ Fluent::Plugin.register_output("remote_syslog_tcp", self)
8
+
9
+ config_param :hostname, :string, :default => ""
10
+
11
+ include Fluent::Mixin::PlainTextFormatter
12
+ include Fluent::Mixin::ConfigPlaceholders
13
+ include Fluent::HandleTagNameMixin
14
+ include Fluent::Mixin::RewriteTagName
15
+
16
+ config_param :host, :string
17
+ config_param :port, :integer, :default => 514
18
+
19
+ config_param :facility, :string, :default => "syslog"
20
+ config_param :severity, :string, :default => "debug"
21
+ config_param :tag, :string, :default => "fluentd"
22
+
23
+ def initialize
24
+ super
25
+ require "remote_syslog_logger_custom"
26
+ @loggers = {}
27
+ end
28
+
29
+ def shutdown
30
+ @loggers.values.each(&:close)
31
+ super
32
+ end
33
+
34
+ def emit(tag, es, chain)
35
+ es.each do |time, record|
36
+ record.each_pair do |k, v|
37
+ if v.is_a?(String)
38
+ v.force_encoding("utf-8")
39
+ end
40
+ end
41
+
42
+ tag = rewrite_tag!(tag.dup)
43
+ @loggers[tag] ||= RemoteSyslogLogger::TcpSender.new(@host,
44
+ @port,
45
+ facility: record["facility"] || @facility,
46
+ severity: record["severity"] || @severity,
47
+ program: tag,
48
+ local_hostname: @hostname)
49
+
50
+ @loggers[tag].transmit format(tag, time, record)
51
+ end
52
+ chain.next
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,62 @@
1
+ require "test_helper"
2
+ require "fluent/plugin/out_remote_syslog"
3
+
4
+ class RemoteSyslogOutputTest < MiniTest::Unit::TestCase
5
+ def setup
6
+ Fluent::Test.setup
7
+ end
8
+
9
+ def create_driver(conf = CONFIG, tag = "test.remote_syslog")
10
+ Fluent::Test::OutputTestDriver.new(Fluent::RemoteSyslogOutput, tag) {}.configure(conf)
11
+ end
12
+
13
+ def test_configure
14
+ d = create_driver %[
15
+ type remote_syslog
16
+ hostname foo.com
17
+ host example.com
18
+ port 5566
19
+ severity debug
20
+ tag minitest
21
+ ]
22
+
23
+ d.run do
24
+ d.emit(message: "foo")
25
+ end
26
+
27
+ loggers = d.instance.instance_variable_get(:@loggers)
28
+ refute_empty loggers
29
+
30
+ logger = loggers.values.first
31
+
32
+ assert_equal "example.com", logger.instance_variable_get(:@remote_hostname)
33
+ assert_equal 5566, logger.instance_variable_get(:@remote_port)
34
+
35
+ p = logger.instance_variable_get(:@packet)
36
+ assert_equal "foo.com", p.hostname
37
+ assert_equal 1, p.facility
38
+ assert_equal "minitest", p.tag
39
+ assert_equal 7, p.severity
40
+ end
41
+
42
+ def test_rewrite_tag
43
+ d = create_driver %[
44
+ type remote_syslog
45
+ hostname foo.com
46
+ host example.com
47
+ port 5566
48
+ severity debug
49
+ tag rewrited.${tag_parts[1]}
50
+ ]
51
+
52
+ d.run do
53
+ d.emit(message: "foo")
54
+ end
55
+
56
+ loggers = d.instance.instance_variable_get(:@loggers)
57
+ logger = loggers.values.first
58
+
59
+ p = logger.instance_variable_get(:@packet)
60
+ assert_equal "rewrited.remote_syslog", p.tag
61
+ end
62
+ end
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+ require "minitest/autorun"
5
+ require "minitest/unit"
6
+ require "minitest/pride"
7
+ require "fluent/test"
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-remote_syslog_tcp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.3
5
+ platform: ruby
6
+ authors:
7
+ - Richard Lee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: test-unit-minitest
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: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: fluentd
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
+ - !ruby/object:Gem::Dependency
70
+ name: fluent-mixin-plaintextformatter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: remote_syslog_logger_custom
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fluent-mixin-config-placeholders
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: fluent-mixin-rewrite-tag-name
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: ''
126
+ email:
127
+ - dlackty@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".DS_Store"
133
+ - ".gitignore"
134
+ - ".travis.yml"
135
+ - CHANGELOG.md
136
+ - Gemfile
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - VERSION
141
+ - fluent-plugin-remote_syslog_tcp.gemspec
142
+ - lib/fluent/plugin/out_remote_syslog_tcp.rb
143
+ - test/plugin/out_remote_syslog.rb
144
+ - test/test_helper.rb
145
+ homepage:
146
+ licenses:
147
+ - MIT
148
+ metadata: {}
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubyforge_project:
165
+ rubygems_version: 2.5.1
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: Fluentd output plugin for remote syslog
169
+ test_files:
170
+ - test/plugin/out_remote_syslog.rb
171
+ - test/test_helper.rb