fluent-plugin-kubernetes_remote_syslog 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +28 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/fluent-plugin-kubernetes_remote_syslog.gemspec +28 -0
- data/lib/fluent/plugin/out_kubernetes_remote_syslog.rb +55 -0
- data/test/plugin/out_remote_syslog.rb +62 -0
- data/test/test_helper.rb +7 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d9aba1606587eef863a307f8da2fc75050ebe409
|
4
|
+
data.tar.gz: 9f3840565a3b84a5574b43ff1d7226a681a0b3eb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 761c98be4f546a4d6a30371df531c529af512e471c50dda7a8bbc6ca401258fdfb8e00d6a7886290e4e9715ca0db38443d293a443d024dfb1da8e761b2d8964d
|
7
|
+
data.tar.gz: 0ab0ba385c85d47ea00686e8c2b50396a24403fddb96b0fd2a6383646c9c132479eb0d4ffb45f9fb6190ed76c8b4158fdf31e1c29b8d5a4d67ef16bbfe41e177
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
## 0.3.3
|
2
|
+
|
3
|
+
* Forked from https://github.com/dlackty/fluent-plugin-remote_syslog to add specific parsing for kubernetes.
|
4
|
+
|
5
|
+
## 0.3.2
|
6
|
+
|
7
|
+
* Rewrite plugin to make rewrite tag function work properly [#4](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/4)
|
8
|
+
|
9
|
+
## 0.3.1
|
10
|
+
|
11
|
+
* Fix errors in last release [#3](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/3)
|
12
|
+
|
13
|
+
## 0.3.0 (yanked)
|
14
|
+
|
15
|
+
* Integrate with `Fluent::Mixin::RewriteTagName` [#2](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/2)
|
16
|
+
|
17
|
+
## 0.2.1
|
18
|
+
|
19
|
+
* Fix encoding issue
|
20
|
+
|
21
|
+
## 0.2.0
|
22
|
+
|
23
|
+
* Integrate with `Fluent::Mixin::PlainTextFormatter`
|
24
|
+
* **BREAKING**: Remove `key_name` config, use `output_data_type` instead
|
25
|
+
|
26
|
+
## 0.1.0
|
27
|
+
|
28
|
+
* Initial release
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 George Goh
|
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-kubernetes_remote_syslog
|
2
|
+
|
3
|
+
[Fluentd](http://fluentd.org) plugin for output to remote syslog serivce (e.g. [Papertrail](http://papertrailapp.com/))
|
4
|
+
|
5
|
+
This repo was forked from https://github.com/dlackty/fluent-plugin-remote_syslog
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fluent-gem install fluent-plugin-kubernetes_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-2015 Richard Lee, George Goh. See LICENSE for details.
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3.3
|
@@ -0,0 +1,28 @@
|
|
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-kubernetes_remote_syslog"
|
7
|
+
spec.version = File.read("VERSION").strip
|
8
|
+
spec.authors = ["George Goh"]
|
9
|
+
spec.email = ["georgegohkokleong@gmail.com"]
|
10
|
+
spec.summary = %q{Fluentd output plugin for remote syslog, specific to kubernetes logs}
|
11
|
+
spec.description = spec.description
|
12
|
+
spec.homepage = "https://github.com/georgegoh/fluent-plugin-kubernetes_remote_syslog"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
20
|
+
spec.add_development_dependency "test-unit-minitest"
|
21
|
+
spec.add_development_dependency "minitest"
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "fluentd"
|
24
|
+
spec.add_runtime_dependency "fluent-mixin-plaintextformatter"
|
25
|
+
spec.add_runtime_dependency "remote_syslog_logger", "~> 1.0.0"
|
26
|
+
spec.add_runtime_dependency "fluent-mixin-config-placeholders"
|
27
|
+
spec.add_runtime_dependency "fluent-mixin-rewrite-tag-name"
|
28
|
+
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 RemoteSyslogOutput < Fluent::Output
|
7
|
+
Fluent::Plugin.register_output("kubernetes_remote_syslog", 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 => "user"
|
20
|
+
config_param :severity, :string, :default => "notice"
|
21
|
+
config_param :tag, :string, :default => "fluentd"
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
super
|
25
|
+
require "remote_syslog_logger"
|
26
|
+
@loggers = {}
|
27
|
+
end
|
28
|
+
|
29
|
+
def shutdown
|
30
|
+
super
|
31
|
+
@loggers.values.each(&:close)
|
32
|
+
end
|
33
|
+
|
34
|
+
def emit(tag, es, chain)
|
35
|
+
chain.next
|
36
|
+
es.each do |time, record|
|
37
|
+
record.each_pair do |k, v|
|
38
|
+
if v.is_a?(String)
|
39
|
+
v.force_encoding("utf-8")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
tag = rewrite_tag!(tag.dup)
|
44
|
+
@loggers[tag] ||= RemoteSyslogLogger::UdpSender.new(@host,
|
45
|
+
@port,
|
46
|
+
facility: @facility,
|
47
|
+
severity: @severity,
|
48
|
+
program: tag,
|
49
|
+
local_hostname: record['kubernetes_host'])
|
50
|
+
|
51
|
+
@loggers[tag].transmit format(tag, time, record)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "fluent/plugin/out_kubernetes_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.kubernetes_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 kubernetes_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 kubernetes_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.kubernetes_remote_syslog", p.tag
|
61
|
+
end
|
62
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-kubernetes_remote_syslog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- George Goh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-30 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
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.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
|
+
- georgegohkokleong@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".travis.yml"
|
134
|
+
- CHANGELOG.md
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- VERSION
|
140
|
+
- fluent-plugin-kubernetes_remote_syslog.gemspec
|
141
|
+
- lib/fluent/plugin/out_kubernetes_remote_syslog.rb
|
142
|
+
- test/plugin/out_remote_syslog.rb
|
143
|
+
- test/test_helper.rb
|
144
|
+
homepage: https://github.com/georgegoh/fluent-plugin-kubernetes_remote_syslog
|
145
|
+
licenses:
|
146
|
+
- MIT
|
147
|
+
metadata: {}
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubyforge_project:
|
164
|
+
rubygems_version: 2.4.8
|
165
|
+
signing_key:
|
166
|
+
specification_version: 4
|
167
|
+
summary: Fluentd output plugin for remote syslog, specific to kubernetes logs
|
168
|
+
test_files:
|
169
|
+
- test/plugin/out_remote_syslog.rb
|
170
|
+
- test/test_helper.rb
|