fluent-plugin-exec_placeholder 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +3 -0
- data/.gitignore +9 -0
- data/.travis.yml +15 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +4 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +51 -0
- data/Rakefile +11 -0
- data/exsample/exsample.conf +9 -0
- data/fluent-plugin-exec_placeholder.gemspec +26 -0
- data/lib/fluent/plugin/out_exec_placeholder.rb +37 -0
- data/test/helper.rb +18 -0
- data/test/plugin/test_out_exec_placeholder.rb +33 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8770082b98e23c1232d61d424415dedd6a443600
|
4
|
+
data.tar.gz: 08e182e5667828cd1bd3334cdb5f2b9f31b3ba0d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d01cb0fd917288480dd0026c1d67c17a5bfbd4cd080866450b8f80fe8253baa499c064d79ee8fce9f1c75d5f28aa047e1a3faed985b07c0487e1a6a53fcdf1cb
|
7
|
+
data.tar.gz: 772f18a0b075ccd17fc12f8ae59ba225e93a90457c7fc2d56b106f34db3052c6a1fd152e493ef02efca76221ddce12ac43bcb54dd0f25984f8c8c2eb2b283659
|
data/.document
ADDED
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --title "fluent-plugin-exec_placeholder Documentation" --protected
|
data/ChangeLog.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2016 toyama0919
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# fluent-plugin-exec_placeholder [](http://travis-ci.org/toyama0919/fluent-plugin-exec_placeholder)
|
2
|
+
|
3
|
+
ExecPlaceholder plugin for fluentd
|
4
|
+
|
5
|
+
## Examples
|
6
|
+
|
7
|
+
#### setting
|
8
|
+
```
|
9
|
+
<match {command,ping_port}.presto.**>
|
10
|
+
type exec_placeholder
|
11
|
+
command /etc/init.d/presto ${message}
|
12
|
+
</match>
|
13
|
+
```
|
14
|
+
|
15
|
+
#### input
|
16
|
+
|
17
|
+
```
|
18
|
+
{ "message":"restart" }
|
19
|
+
```
|
20
|
+
|
21
|
+
#### output
|
22
|
+
|
23
|
+
```
|
24
|
+
execute `/etc/init.d/presto restart`
|
25
|
+
```
|
26
|
+
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
```
|
30
|
+
fluent-gem install fluent-plugin-exec_placeholder
|
31
|
+
```
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create new [Pull Request](../../pull/new/master)
|
40
|
+
|
41
|
+
## Information
|
42
|
+
|
43
|
+
* [Homepage](https://github.com/toyama0919/fluent-plugin-exec_placeholder)
|
44
|
+
* [Issues](https://github.com/toyama0919/fluent-plugin-exec_placeholder/issues)
|
45
|
+
* [Documentation](http://rubydoc.info/gems/fluent-plugin-exec_placeholder/frames)
|
46
|
+
* [Email](mailto:toyama0919@gmail.com)
|
47
|
+
|
48
|
+
## Copyright
|
49
|
+
|
50
|
+
Copyright (c) 2016 toyama0919
|
51
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "fluent-plugin-exec_placeholder"
|
5
|
+
gem.version = "0.0.1"
|
6
|
+
gem.summary = %q{ExecPlaceholder plugin for fluentd}
|
7
|
+
gem.description = %q{ExecPlaceholder plugin for fluentd}
|
8
|
+
gem.license = "MIT"
|
9
|
+
gem.authors = ["toyama0919"]
|
10
|
+
gem.email = "toyama0919@gmail.com"
|
11
|
+
gem.homepage = "https://github.com/toyama0919/fluent-plugin-exec_placeholder"
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($/)
|
14
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
gem.require_paths = ['lib']
|
17
|
+
|
18
|
+
gem.add_dependency 'fluentd'
|
19
|
+
|
20
|
+
gem.add_development_dependency 'bundler'
|
21
|
+
gem.add_development_dependency 'pry', '~> 0.10.1'
|
22
|
+
gem.add_development_dependency 'rake', '~> 10.3.2'
|
23
|
+
gem.add_development_dependency 'rubocop', '~> 0.24.1'
|
24
|
+
gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
|
25
|
+
gem.add_development_dependency 'yard', '~> 0.8'
|
26
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Fluent
|
4
|
+
class ExecPlaceholderOutput < Output
|
5
|
+
Fluent::Plugin.register_output('exec_placeholder', self)
|
6
|
+
PLACEHOLDER_REGEXP = /\$\{([^}]+)\}/
|
7
|
+
ERB_REGEXP = "<%=record['" + '\1' + "'] %>"
|
8
|
+
|
9
|
+
desc 'The command (program) to execute.'
|
10
|
+
config_param :command, :string
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def configure(conf)
|
17
|
+
super
|
18
|
+
@erb = ERB.new(@command.gsub(PLACEHOLDER_REGEXP, ERB_REGEXP))
|
19
|
+
end
|
20
|
+
|
21
|
+
def format(tag, time, record)
|
22
|
+
[tag, time, record].to_msgpack
|
23
|
+
end
|
24
|
+
|
25
|
+
def emit(tag, es, chain)
|
26
|
+
es.each {|time, record|
|
27
|
+
prog = @erb.result(binding)
|
28
|
+
system(prog)
|
29
|
+
ecode = $?.to_i
|
30
|
+
if ecode != 0
|
31
|
+
raise "command returns #{ecode}: #{prog}"
|
32
|
+
end
|
33
|
+
}
|
34
|
+
chain.next
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
|
+
require 'fluent/test'
|
15
|
+
require 'fluent/plugin/out_exec_placeholder'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
class ExecPlaceholderOutputTest < Test::Unit::TestCase
|
3
|
+
def setup
|
4
|
+
Fluent::Test.setup
|
5
|
+
end
|
6
|
+
|
7
|
+
CONFIG = %[
|
8
|
+
|
9
|
+
]
|
10
|
+
|
11
|
+
def create_driver(conf = CONFIG, tag='test')
|
12
|
+
Fluent::Test::OutputTestDriver.new(Fluent::ExecPlaceholderOutput, tag).configure(conf)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_configure
|
16
|
+
d = create_driver(CONFIG + "\noutput_type json")
|
17
|
+
assert_equal :json, d.instance.output_type
|
18
|
+
|
19
|
+
assert_raise(Fluent::ConfigError) do
|
20
|
+
d = create_driver(CONFIG)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_emit
|
25
|
+
d1 = create_driver(CONFIG, 'input.access')
|
26
|
+
d1.run do
|
27
|
+
d1.emit({'domain' => 'www.google.com', 'path' => '/foo/bar?key=value', 'agent' => 'Googlebot', 'response_time' => 1000000})
|
28
|
+
d1.emit({'domain' => 'news.google.com', 'path' => '/', 'agent' => 'Googlebot-Mobile', 'response_time' => 900000})
|
29
|
+
end
|
30
|
+
emits = d1.emits
|
31
|
+
assert_equal 5, emits.length
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-exec_placeholder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- toyama0919
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-21 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'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '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: '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: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.10.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.10.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 10.3.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 10.3.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.24.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.24.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubygems-tasks
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.8'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.8'
|
111
|
+
description: ExecPlaceholder plugin for fluentd
|
112
|
+
email: toyama0919@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- ".document"
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- ".yardopts"
|
121
|
+
- ChangeLog.md
|
122
|
+
- Gemfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- exsample/exsample.conf
|
127
|
+
- fluent-plugin-exec_placeholder.gemspec
|
128
|
+
- lib/fluent/plugin/out_exec_placeholder.rb
|
129
|
+
- test/helper.rb
|
130
|
+
- test/plugin/test_out_exec_placeholder.rb
|
131
|
+
homepage: https://github.com/toyama0919/fluent-plugin-exec_placeholder
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.4.8
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: ExecPlaceholder plugin for fluentd
|
155
|
+
test_files:
|
156
|
+
- test/helper.rb
|
157
|
+
- test/plugin/test_out_exec_placeholder.rb
|
158
|
+
has_rdoc:
|