fluent-plugin-multi-format-parser 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/.travis.yml +19 -0
- data/Gemfile +3 -0
- data/README.md +50 -0
- data/Rakefile +14 -0
- data/VERSION +1 -0
- data/fluent-plugin-multi-format-parser.gemspec +22 -0
- data/lib/fluent/plugin/parser_multi_format.rb +53 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cddae10dd64bc3831e60a367068d0ed2e83d23db
|
4
|
+
data.tar.gz: 79c4d6a4c3bee3d9b08b0c65ca898debb3856183
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f282279056e844ac486981990f32b2f048aaf44516bdcaa996693c62229572983a06f4747414ce08c9a7b86770b2079bd705365bfaefa544890cdffb77a0fd56
|
7
|
+
data.tar.gz: ca96a092b89220ad3de24f204c97f7a3d2d715057ee32c5946b48dbf5bc5ad1e991e573ea9db10e7c9917674aa08597c4aebe7b51b458959bea44faad8515362
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Multi format parser plugin for Fluentd
|
2
|
+
|
3
|
+
Parse format mixed logs.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Use RubyGems:
|
8
|
+
|
9
|
+
fluent-gem install fluent-plugin-multi-format-parser
|
10
|
+
|
11
|
+
## Configuration
|
12
|
+
|
13
|
+
This plugin is a parser plugin. After installed, you can use `multi_format` in `format` supported plugins.
|
14
|
+
Use multiple `<pattern>` to specify multiple format.
|
15
|
+
|
16
|
+
<source>
|
17
|
+
type udp
|
18
|
+
tag logs.multi
|
19
|
+
|
20
|
+
format multi_format
|
21
|
+
<pattern>
|
22
|
+
format apache
|
23
|
+
</pattern>
|
24
|
+
<pattern>
|
25
|
+
format json
|
26
|
+
time_key timestamp
|
27
|
+
</pattern>
|
28
|
+
<pattern>
|
29
|
+
format none
|
30
|
+
</pattern>
|
31
|
+
</match>
|
32
|
+
|
33
|
+
`multi_format` tries pattern matching from top to bottom and returns parsed result when matched.
|
34
|
+
|
35
|
+
Available format patterns and parameters are depends on Fluentd parsers.
|
36
|
+
See [in_tail format document](http://docs.fluentd.org/articles/in_tail) for more details.
|
37
|
+
|
38
|
+
## Copyright
|
39
|
+
|
40
|
+
<table>
|
41
|
+
<tr>
|
42
|
+
<td>Author</td><td>Masahiro Nakagawa <repeatedly@gmail.com></td>
|
43
|
+
</tr>
|
44
|
+
<tr>
|
45
|
+
<td>Copyright</td><td>Copyright (c) 2014- Masahiro Nakagawa</td>
|
46
|
+
</tr>
|
47
|
+
<tr>
|
48
|
+
<td>License</td><td>MIT License</td>
|
49
|
+
</tr>
|
50
|
+
</table>
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
require 'rake/testtask'
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |test|
|
8
|
+
test.libs << 'lib' << 'test'
|
9
|
+
test.test_files = FileList['test/*.rb']
|
10
|
+
test.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
task :default => [:build]
|
14
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "fluent-plugin-multi-format-parser"
|
6
|
+
gem.description = "Multi format parser plugin for Fluentd"
|
7
|
+
gem.homepage = "https://github.com/repeatedly/fluent-plugin-multi-format-parser"
|
8
|
+
gem.summary = gem.description
|
9
|
+
gem.version = File.read("VERSION").strip
|
10
|
+
gem.authors = ["Masahiro Nakagawa"]
|
11
|
+
gem.email = "repeatedly@gmail.com"
|
12
|
+
gem.has_rdoc = false
|
13
|
+
#gem.platform = Gem::Platform::RUBY
|
14
|
+
gem.license = 'Apache License (2.0)'
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
|
20
|
+
gem.add_dependency "fluentd", "~> 0.10.46"
|
21
|
+
gem.add_development_dependency "rake", ">= 0.9.2"
|
22
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'fluent/parser'
|
2
|
+
|
3
|
+
module Fluent
|
4
|
+
class TextParser
|
5
|
+
class MultiFormatParser
|
6
|
+
include Configurable
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
|
11
|
+
@parsers = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure(conf)
|
15
|
+
super
|
16
|
+
|
17
|
+
conf.elements.each { |e|
|
18
|
+
next unless ['pattern', 'format'].include?(e.name)
|
19
|
+
|
20
|
+
parser = TextParser.new
|
21
|
+
parser.configure(e)
|
22
|
+
@parsers << parser.parser
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def call(text)
|
27
|
+
@parsers.each { |parser|
|
28
|
+
begin
|
29
|
+
parser.call(text) { |time, record|
|
30
|
+
if time && record
|
31
|
+
if block_given?
|
32
|
+
yield time, record
|
33
|
+
return
|
34
|
+
else
|
35
|
+
return time, record
|
36
|
+
end
|
37
|
+
end
|
38
|
+
}
|
39
|
+
rescue # ignore parser error
|
40
|
+
end
|
41
|
+
}
|
42
|
+
|
43
|
+
if block_given?
|
44
|
+
yield nil, nil
|
45
|
+
else
|
46
|
+
return nil, nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
register_template('multi_format', Proc.new { MultiFormatParser.new })
|
52
|
+
end
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-multi-format-parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masahiro Nakagawa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-10 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.10.46
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.10.46
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.9.2
|
41
|
+
description: Multi format parser plugin for Fluentd
|
42
|
+
email: repeatedly@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- ".travis.yml"
|
48
|
+
- Gemfile
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- VERSION
|
52
|
+
- fluent-plugin-multi-format-parser.gemspec
|
53
|
+
- lib/fluent/plugin/parser_multi_format.rb
|
54
|
+
homepage: https://github.com/repeatedly/fluent-plugin-multi-format-parser
|
55
|
+
licenses:
|
56
|
+
- Apache License (2.0)
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.2.2
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Multi format parser plugin for Fluentd
|
78
|
+
test_files: []
|