fluent-plugin-docker 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 +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +13 -0
- data/README.md +57 -0
- data/Rakefile +2 -0
- data/fluent-plugin-docker.gemspec +24 -0
- data/lib/fluent/plugin/filter_docker.rb +44 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 33e88545ea48afff9a82c81d5851dd8666e137f4
|
4
|
+
data.tar.gz: 98242f8f6ad331c810c3f48110b01e3fbe915f0c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52879550a37248e53120f21a5b4e4f8e30378616be8429bf5d9f6e718702bdd53bdc8a0d806edc9ff27869d2d620dbb0665a363de61fb6dc902e6aed03361c56
|
7
|
+
data.tar.gz: 154a7f5fd355f570275de424b1f6a6475f785a478869411afa66d7246a678826a0b48b6ac9414c823ec5a0e7855838747f01cda94bd06428a2e877c5a355a416
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (C) 2016 Treasure Data <eduardo@treasure-data.com>
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# fluent-plugin-docker
|
2
|
+
|
3
|
+
This _Gem_ is a [Fluentd](http://fluentd.org) plugin filter that helps to manage [Docker](http://www.docker.com) logs. When enabled, it main functionality is to check and convert quoted JSON _log_ messages into real JSON format, e.g:
|
4
|
+
|
5
|
+
From
|
6
|
+
|
7
|
+
```
|
8
|
+
{"source":"stdout","log":"{\"msg\":12345}","container_id":"d6baf71","container_name":"/furious_babbage"}
|
9
|
+
```
|
10
|
+
|
11
|
+
to
|
12
|
+
|
13
|
+
```
|
14
|
+
{"source":"stdout","log":{"msg":12345},"container_id":"d6baf71","container_name":"/furious_babbage"}
|
15
|
+
```
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
### Native gem
|
20
|
+
|
21
|
+
```bash
|
22
|
+
$ gem install fluent-plugin-docker
|
23
|
+
```
|
24
|
+
|
25
|
+
### Fluentd gem
|
26
|
+
|
27
|
+
```bash
|
28
|
+
$ fluent-gem install fluent-plugin-docker
|
29
|
+
```
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
In your Fluentd configuration file, the Docker plugin filter can be used as follows:
|
34
|
+
|
35
|
+
```
|
36
|
+
<source>
|
37
|
+
type forward
|
38
|
+
port 24224
|
39
|
+
bind 0.0.0.0
|
40
|
+
</source>
|
41
|
+
|
42
|
+
<filter docker.**>
|
43
|
+
type docker
|
44
|
+
</filter>
|
45
|
+
|
46
|
+
<match **>
|
47
|
+
type stdout
|
48
|
+
</match>
|
49
|
+
```
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/edsiper/fluent-plugin-docker.
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
The gem is available as open source under the terms of the [Apache v2 License](http://www.apache.org/licenses/LICENSE-2.0)
|
data/Rakefile
ADDED
@@ -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-docker"
|
7
|
+
spec.version = "0.1.0"
|
8
|
+
spec.authors = ["Eduardo Silva"]
|
9
|
+
spec.email = ["eduardo@treasure-data.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{fluentd plugin to handle and format Docker logs.}
|
12
|
+
spec.description = %q{fluentd plugin to handle and format Docker logs.}
|
13
|
+
spec.homepage = "https://github.com/edsiper/fluent-plugin-docker"
|
14
|
+
spec.license = "Apache-2.0"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|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("yajl-ruby", ["~> 1.0"])
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'yajl'
|
18
|
+
require 'fluent/filter'
|
19
|
+
require 'fluent/plugin'
|
20
|
+
|
21
|
+
module Fluent
|
22
|
+
class DockerFilter < Filter
|
23
|
+
Plugin.register_filter('docker', self)
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def configure(conf)
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def filter(tag, time, record)
|
34
|
+
if record.has_key?('log')
|
35
|
+
log = record['log']
|
36
|
+
if log[0] == '{' || log[0] == '['
|
37
|
+
log_json = Yajl.load(log)
|
38
|
+
record['log'] = log_json
|
39
|
+
end
|
40
|
+
end
|
41
|
+
record
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-docker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eduardo Silva
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yajl-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: fluentd plugin to handle and format Docker logs.
|
56
|
+
email:
|
57
|
+
- eduardo@treasure-data.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- fluent-plugin-docker.gemspec
|
68
|
+
- lib/fluent/plugin/filter_docker.rb
|
69
|
+
homepage: https://github.com/edsiper/fluent-plugin-docker
|
70
|
+
licenses:
|
71
|
+
- Apache-2.0
|
72
|
+
metadata: {}
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 2.4.3
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: fluentd plugin to handle and format Docker logs.
|
93
|
+
test_files: []
|