Skip to content

Commit 086a9f6

Browse files
committed
First commit
0 parents  commit 086a9f6

9 files changed

+141
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.1.0
2+
3+
* Initial release

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in fluent-plugin-remote_syslog.gemspec
4+
gemspec

LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# fluent-plugin-remote_syslog
2+
3+
[Fluentd](http://fluentd.org) plugin for output to remote syslog serivce (e.g. [Papertrail](http://papertrailapp.com/))
4+
5+
## Installation
6+
7+
```bash
8+
fluent-gem install fluent-plugin-remote_syslog
9+
```
10+
11+
## Usage
12+
13+
```
14+
<match foo>
15+
type remote_syslog
16+
remote_hostname example.com
17+
port 25
18+
key_name message
19+
severity debug
20+
program fluentd
21+
</match>
22+
```
23+
24+
## License
25+
26+
Copyright (c) 2014 Richard Lee. See LICENSE for details.

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require "bundler/gem_tasks"
2+

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

fluent-plugin-remote_syslog.gemspec

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = ["[email protected]"]
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
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
require "fluent/mixin/config_placeholders"
2+
3+
class RemoteSyslogOutput < Fluent::Output
4+
Fluent::Plugin.register_output("remote_syslog", self)
5+
6+
config_param :hostname, :string, :default => ""
7+
8+
config_param :key_name, :string, :default => "message"
9+
10+
config_param :remote_hostname, :string
11+
config_param :port, :integer, :default => 25
12+
13+
config_param :facility, :string, :default => "user"
14+
config_param :severity, :string, :default => "notice"
15+
config_param :tag, :string, :default => "fluentd"
16+
17+
include Fluent::Mixin::ConfigPlaceholders
18+
19+
def initialize
20+
super
21+
require "remote_syslog_logger"
22+
end
23+
24+
def configure(conf)
25+
super
26+
@logger = RemoteSyslogLogger::UdpSender.new(@remote_hostname,
27+
@port,
28+
facility: @facility,
29+
severity: @severity,
30+
program: @tag,
31+
local_hostname: @hostname)
32+
end
33+
34+
def shutdown
35+
super
36+
@logger.close if @logger
37+
end
38+
39+
def emit(tag, es, chain)
40+
chain.next
41+
es.each do |time, record|
42+
@logger.transmit record[@key_name]
43+
end
44+
end
45+
end

0 commit comments

Comments
 (0)