fluent-plugin-remote_syslog 0.1.0
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 +5 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +28 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/fluent-plugin-remote_syslog.gemspec +24 -0
- data/lib/fluent/plugin/out_remote_syslog.rb +47 -0
- data/test/plugin/out_remote_syslog.rb +36 -0
- data/test/test_helper.rb +5 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 09d1d9c6da7d85674f725ba60ecd0c022806dea2
|
4
|
+
data.tar.gz: c42c263e5406e5c683be885842c191902d843f85
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a03e8beb66095b7cd11486cbf949a49eb0c58b8935634b730f3a6e2b1e031ba263c97c6085849519409ed5ea10bcc2f01fad3d1f6eb09d07fce9259c994e139
|
7
|
+
data.tar.gz: 624b92919575f81b6c5094be79bc98f6100198e28866ac2e19d7f52e6eac7867b2e6090ee66e4ec73d1ed204a7e2ae9160a6cbe722b06ee6828fafa804df79d0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
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,28 @@
|
|
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 25
|
20
|
+
key_name message
|
21
|
+
severity debug
|
22
|
+
program fluentd
|
23
|
+
</match>
|
24
|
+
```
|
25
|
+
|
26
|
+
## License
|
27
|
+
|
28
|
+
Copyright (c) 2014 Richard Lee. See LICENSE for details.
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,24 @@
|
|
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"
|
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.homepage = "https://github.com/dlackty/fluent-plugin-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
|
+
|
21
|
+
spec.add_dependency "fluentd"
|
22
|
+
spec.add_dependency "remote_syslog_logger", "~> 1.0.0"
|
23
|
+
spec.add_dependency "fluent-mixin-config-placeholders", "~> 0.2.0"
|
24
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "fluent/mixin/config_placeholders"
|
2
|
+
|
3
|
+
module Fluent
|
4
|
+
class RemoteSyslogOutput < Fluent::Output
|
5
|
+
Fluent::Plugin.register_output("remote_syslog", self)
|
6
|
+
|
7
|
+
config_param :hostname, :string, :default => ""
|
8
|
+
|
9
|
+
config_param :key_name, :string, :default => "message"
|
10
|
+
|
11
|
+
config_param :host, :string
|
12
|
+
config_param :port, :integer, :default => 25
|
13
|
+
|
14
|
+
config_param :facility, :string, :default => "user"
|
15
|
+
config_param :severity, :string, :default => "notice"
|
16
|
+
config_param :tag, :string, :default => "fluentd"
|
17
|
+
|
18
|
+
include Fluent::Mixin::ConfigPlaceholders
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
super
|
22
|
+
require "remote_syslog_logger"
|
23
|
+
end
|
24
|
+
|
25
|
+
def configure(conf)
|
26
|
+
super
|
27
|
+
@logger = RemoteSyslogLogger::UdpSender.new(@host,
|
28
|
+
@port,
|
29
|
+
facility: @facility,
|
30
|
+
severity: @severity,
|
31
|
+
program: @tag,
|
32
|
+
local_hostname: @hostname)
|
33
|
+
end
|
34
|
+
|
35
|
+
def shutdown
|
36
|
+
super
|
37
|
+
@logger.close if @logger
|
38
|
+
end
|
39
|
+
|
40
|
+
def emit(tag, es, chain)
|
41
|
+
chain.next
|
42
|
+
es.each do |time, record|
|
43
|
+
@logger.transmit record[@key_name]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "fluent/plugin/out_remote_syslog"
|
3
|
+
|
4
|
+
class RemoteSyslogOutputTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
Fluent::Test.setup
|
8
|
+
end
|
9
|
+
|
10
|
+
CONFIG = %[
|
11
|
+
type remote_syslog
|
12
|
+
hostname foo.com
|
13
|
+
host example.com
|
14
|
+
port 5566
|
15
|
+
severity debug
|
16
|
+
tag testunit
|
17
|
+
]
|
18
|
+
|
19
|
+
def create_driver(conf = CONFIG)
|
20
|
+
Fluent::Test::OutputTestDriver.new(Fluent::RemoteSyslogOutput) {}.configure(conf)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_configure
|
24
|
+
d = create_driver
|
25
|
+
logger = d.instance.instance_variable_get(:@logger)
|
26
|
+
|
27
|
+
assert_not_nil logger
|
28
|
+
assert_equal "example.com", logger.instance_variable_get(:@remote_hostname)
|
29
|
+
assert_equal 5566, logger.instance_variable_get(:@remote_port)
|
30
|
+
p = logger.instance_variable_get(:@packet)
|
31
|
+
assert_equal "foo.com", p.hostname
|
32
|
+
assert_equal 1, p.facility
|
33
|
+
assert_equal "testunit", p.tag
|
34
|
+
assert_equal 7, p.severity
|
35
|
+
end
|
36
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-remote_syslog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Lee
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-23 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: fluentd
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
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: remote_syslog_logger
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fluent-mixin-config-placeholders
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.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.2.0
|
69
|
+
description: ''
|
70
|
+
email:
|
71
|
+
- dlackty@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- CHANGELOG.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- VERSION
|
84
|
+
- fluent-plugin-remote_syslog.gemspec
|
85
|
+
- lib/fluent/plugin/out_remote_syslog.rb
|
86
|
+
- test/plugin/out_remote_syslog.rb
|
87
|
+
- test/test_helper.rb
|
88
|
+
homepage: https://github.com/dlackty/fluent-plugin-remote_syslog
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Fluentd output plugin for remote syslog
|
112
|
+
test_files:
|
113
|
+
- test/plugin/out_remote_syslog.rb
|
114
|
+
- test/test_helper.rb
|