fluent-plugin-graylog 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +6 -0
- data/Gemfile +3 -0
- data/LICENSE.md +29 -0
- data/README.md +29 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/circle.yml +8 -0
- data/fluent-plugin-graylog.gemspec +29 -0
- data/lib/fluent/plugin/out_graylog.rb +54 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d80051ea0baf8bfdb65313d56849e651059809f0
|
4
|
+
data.tar.gz: 7f37f033c4b5d0bf566b7b7611b7becfc2c91d5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 58d714731c7b6734c6cae3a7a738ac37a3ce146fa3ac2a8b5c5b2b00a4dd8df707c7000b252a9604bb6e0e9fb3cb9a03f3d22c9ce5941a512bbca244cb0d417d
|
7
|
+
data.tar.gz: e9a34a30a5924a1874f563abd081df37752ee34d9394ee13516c23497d418c6dc8c913c74edc7283a8a383edb89ccc79c0fb0a0a4ea506351b3b403093c6bee2
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Copyright (c) 2015, Funding Circle Ltd.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
1. Redistributions of source code must retain the above copyright
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
12
|
+
documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
3. Neither the name of the copyright holder nor the names of its
|
15
|
+
contributors may be used to endorse or promote products derived from
|
16
|
+
this software without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
19
|
+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
20
|
+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
21
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
24
|
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
25
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# [GrayLog](http://graylog.org) plugin for [Fluentd](http://fluentd.org) [![Build Status](https://circleci.com/gh/FundingCircle/fluent-plugin-graylog/tree/master.svg?style=shield&circle-token=532f50099abc19d39f00c89faa39e4d85de12788)](https://circleci.com/gh/FundingCircle/fluent-plugin-graylog/tree/master)
|
2
|
+
|
3
|
+
[fluentd](http://fluentd.org) output plugin for GrayLog.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
This plugin is not available as a Gem.
|
8
|
+
|
9
|
+
## Configuration
|
10
|
+
|
11
|
+
Example
|
12
|
+
|
13
|
+
```
|
14
|
+
<match tag>
|
15
|
+
type graylog
|
16
|
+
host graylog.example.com # Required
|
17
|
+
port 12201 # Default
|
18
|
+
|
19
|
+
# BufferedOutput config
|
20
|
+
flush_interval 30
|
21
|
+
num_threads 2
|
22
|
+
# ...
|
23
|
+
</match>
|
24
|
+
```
|
25
|
+
|
26
|
+
## License
|
27
|
+
Copyright © 2015 Funding Circle Ltd.
|
28
|
+
|
29
|
+
Distributed under the BSD 3-Clause License.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'fluent/plugin/graylog'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require 'pry'
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/circle.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# rubocop:disable Metrics/LineLength
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'fluent-plugin-graylog'
|
8
|
+
spec.version = '1.0.1'
|
9
|
+
spec.authors = ['Funding Circle']
|
10
|
+
spec.email = ['engineering@fundingcircle.com']
|
11
|
+
|
12
|
+
spec.summary = 'GrayLog output plugin for Fluentd'
|
13
|
+
spec.description = 'Send logging information in JSON format via TCP to an instance of GrayLog'
|
14
|
+
spec.license = 'BSD-3-Clause'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'fluentd', '~> 0.12'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.3'
|
25
|
+
spec.add_development_dependency 'test-unit', '~> 3.1'
|
26
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.32'
|
28
|
+
end
|
29
|
+
# rubocop:enable Metrics/LineLength
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Fluent
|
2
|
+
class GrayLogOutput < BufferedOutput
|
3
|
+
Plugin.register_output('graylog', self)
|
4
|
+
|
5
|
+
# rubocop:disable Style/NumericLiterals
|
6
|
+
config_param :host, :string, default: nil
|
7
|
+
config_param :port, :integer, default: 12201
|
8
|
+
# rubocop:enable Style/NumericLiterals
|
9
|
+
|
10
|
+
attr_reader :endpoint
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def configure(conf)
|
17
|
+
super
|
18
|
+
fail ConfigError, "'host' parameter required" unless conf.key?('host')
|
19
|
+
end
|
20
|
+
|
21
|
+
def start
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def shutdown
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def format(_tag, _time, record)
|
30
|
+
# Record must already be in GELF
|
31
|
+
record.to_msgpack
|
32
|
+
end
|
33
|
+
|
34
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
35
|
+
def write(chunk)
|
36
|
+
records = []
|
37
|
+
chunk.msgpack_each do |record|
|
38
|
+
records.push JSON.dump(record) + "\0" # Message delimited by null char
|
39
|
+
end
|
40
|
+
|
41
|
+
log.debug 'establishing connection with GrayLog'
|
42
|
+
socket = TCPSocket.new @host, @port
|
43
|
+
|
44
|
+
begin
|
45
|
+
log.debug "sending #{records.count} records in batch"
|
46
|
+
socket.write records.join
|
47
|
+
ensure
|
48
|
+
log.debug 'closing connection with GrayLog'
|
49
|
+
socket.close
|
50
|
+
end
|
51
|
+
end
|
52
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-graylog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Funding Circle
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fluentd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.12'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.32'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.32'
|
97
|
+
description: Send logging information in JSON format via TCP to an instance of GrayLog
|
98
|
+
email:
|
99
|
+
- engineering@fundingcircle.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rubocop.yml"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.md
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- bin/console
|
111
|
+
- bin/setup
|
112
|
+
- circle.yml
|
113
|
+
- fluent-plugin-graylog.gemspec
|
114
|
+
- lib/fluent/plugin/out_graylog.rb
|
115
|
+
homepage:
|
116
|
+
licenses:
|
117
|
+
- BSD-3-Clause
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 2.4.5
|
136
|
+
signing_key:
|
137
|
+
specification_version: 4
|
138
|
+
summary: GrayLog output plugin for Fluentd
|
139
|
+
test_files: []
|
140
|
+
has_rdoc:
|