fluent-plugin-split-string 1.0.0
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/.gitignore +19 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/LICENSE +13 -0
- data/README.md +19 -0
- data/Rakefile +12 -0
- data/fluent-plugin-split-string.gemspec +21 -0
- data/lib/fluent/plugin/filter_split_string.rb +19 -0
- data/test/helper.rb +10 -0
- data/test/plugin/test_filter_split_string.rb +33 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 428da9c413da765bb47186f9bc8bc0bd6c5ea67f
|
4
|
+
data.tar.gz: d657fce9b1eda230a5bd766543b0b7649c265446
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c53f4d798d0c676e4db65118d8aa4135304c58224c7e464bb1f6012402b76b758c13c5690c3ae80bf7d8ebe7c0e1787e0ec8ea984a97c4d0bc505bbaaf55f133
|
7
|
+
data.tar.gz: 50852c2d5dbab596fb2fde8a3b22cb33d2fde19549a30fb9c98cb2445282a25ad18ef23790553318720df2349d1247e8802975380884a5276ba8f68cf1a3abf8
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2012 FUJIWARA Shunichiro
|
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,19 @@
|
|
1
|
+
# fluent-plugin-split-string
|
2
|
+
|
3
|
+
[](https://travis-ci.org/fujiwara/fluent-plugin-split-string)
|
4
|
+
|
5
|
+
Fluentd plugin that splits a string on an event, producing multiple events.
|
6
|
+
|
7
|
+
### Filter plugin
|
8
|
+
|
9
|
+
```
|
10
|
+
<filter foo.**>
|
11
|
+
@type split_string
|
12
|
+
</filter>
|
13
|
+
```
|
14
|
+
|
15
|
+
## Copyright
|
16
|
+
|
17
|
+
Copyright © 2018 Eugene Pirogov
|
18
|
+
|
19
|
+
License MIT, Version 2.0
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# -*- mode:ruby -*-
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
|
5
|
+
require 'rake/testtask'
|
6
|
+
Rake::TestTask.new(:test) do |test|
|
7
|
+
test.libs << 'lib' << 'test'
|
8
|
+
test.pattern = 'test/**/test_*.rb'
|
9
|
+
test.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
task :default => :test
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- mode:ruby -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.authors = ["Eugene Pirogov"]
|
5
|
+
gem.email = ["iamexile@gmail.com"]
|
6
|
+
gem.description = %q{fluentd filter plugin to split messages containing multiple log lines}
|
7
|
+
gem.summary = %q{fluentd filter plugin to split messages containing multiple log lines}
|
8
|
+
gem.homepage = "https://github.com/gmile/fluent-plugin-split-string"
|
9
|
+
gem.license = "Apache-2.0"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test)/})
|
14
|
+
gem.name = "fluent-plugin-split-string"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = "1.0.0"
|
17
|
+
|
18
|
+
gem.add_runtime_dependency "fluentd", "~> 1.0"
|
19
|
+
gem.add_development_dependency "test-unit", "~> 3.0"
|
20
|
+
gem.add_development_dependency "rake", "~> 12.0"
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'fluent/plugin/filter'
|
2
|
+
|
3
|
+
module Fluent::Plugin
|
4
|
+
class SplitStringFilter < Fluent::Plugin::Filter
|
5
|
+
Fluent::Plugin.register_filter('split_string', self)
|
6
|
+
|
7
|
+
def filter_stream(tag, event_stream)
|
8
|
+
new_event_stream = Fluent::MultiEventStream.new
|
9
|
+
|
10
|
+
event_stream.each do |time, record|
|
11
|
+
record["message"].split('\n').each do |line|
|
12
|
+
new_event_stream.add(time, record.merge({"message" => line}))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
new_event_stream
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'fluent/test/driver/filter'
|
3
|
+
require 'fluent/plugin/filter_split_string'
|
4
|
+
|
5
|
+
class SplitStringFilterTest < Test::Unit::TestCase
|
6
|
+
include Fluent
|
7
|
+
|
8
|
+
def setup
|
9
|
+
Fluent::Test.setup
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_driver
|
13
|
+
Fluent::Test::Driver::Filter.new(Fluent::Plugin::SplitStringFilter).configure("")
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_emit
|
17
|
+
driver = create_driver()
|
18
|
+
event_stream = Fluent::MultiEventStream.new
|
19
|
+
|
20
|
+
time = event_time("2014-04-17 07:28:49 UTC")
|
21
|
+
event_stream.add(time, {"some" => "key", "message" => 'a\nb\nc\n'})
|
22
|
+
|
23
|
+
driver.run(default_tag: "test.info") do
|
24
|
+
driver.feed(event_stream)
|
25
|
+
end
|
26
|
+
records = driver.filtered_records
|
27
|
+
|
28
|
+
assert_equal 3, records.length
|
29
|
+
assert_equal({"some" => "key", "message" => "a"}, records[0])
|
30
|
+
assert_equal({"some" => "key", "message" => "b"}, records[1])
|
31
|
+
assert_equal({"some" => "key", "message" => "c"}, records[2])
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-split-string
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eugene Pirogov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-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: '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: test-unit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '12.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '12.0'
|
55
|
+
description: fluentd filter plugin to split messages containing multiple log lines
|
56
|
+
email:
|
57
|
+
- iamexile@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- fluent-plugin-split-string.gemspec
|
69
|
+
- lib/fluent/plugin/filter_split_string.rb
|
70
|
+
- test/helper.rb
|
71
|
+
- test/plugin/test_filter_split_string.rb
|
72
|
+
homepage: https://github.com/gmile/fluent-plugin-split-string
|
73
|
+
licenses:
|
74
|
+
- Apache-2.0
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.5.2
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: fluentd filter plugin to split messages containing multiple log lines
|
96
|
+
test_files:
|
97
|
+
- test/helper.rb
|
98
|
+
- test/plugin/test_filter_split_string.rb
|