fluent-plugin-formatter_tsv 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/.gitignore +14 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +59 -0
- data/Rakefile +18 -0
- data/fluent-plugin-formatter_tsv.gemspec +26 -0
- data/lib/fluent/plugin/formatter_tsv.rb +18 -0
- data/test/helper.rb +8 -0
- data/test/test_formatter_tsv.rb +23 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 631751beb429cde2d926394966e90708254dd2e7
|
4
|
+
data.tar.gz: a5e428bd20a82a82edbb87fdd9238b38c666c7bd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f233378b14ba0128a730969741704bb28cdb1677f8d226b11de17b6277c60e08280092e209dadeac450a20390b9a5c94f170c1f7132ebd65c3a3daa64e355f25
|
7
|
+
data.tar.gz: fde47d0b19c420f174416c04222699eec7e7111fdb2a9607e2b23948249d993cddc6a1084b3776d466e05a443fcdb361779505187f2ffb397bc7c64e900b29bd
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Naotoshi Seo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# fluent-plugin-formatter_tsv
|
2
|
+
|
3
|
+
[](http://travis-ci.org/sonots/fluent-plugin-formatter_tsv)
|
4
|
+
|
5
|
+
Fluentd TSV formatter plugin
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
Use RubyGems:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem install fluent-plugin-formatter_tsv
|
13
|
+
```
|
14
|
+
|
15
|
+
## Configuration Example
|
16
|
+
|
17
|
+
`out_file` and `out_s3` plugin supports formatter plugin.
|
18
|
+
|
19
|
+
```apache
|
20
|
+
<match raw.**>
|
21
|
+
type file
|
22
|
+
path /tmp/tsv_test
|
23
|
+
format tsv
|
24
|
+
</match>
|
25
|
+
```
|
26
|
+
|
27
|
+
## Parameters
|
28
|
+
|
29
|
+
- **include_time_key** (Boolean, Optional, defaults to false) If true, the time field (as specified by the time_key parameter) is kept in the record.
|
30
|
+
- **time_key** (String, xOptional, defaults to “time”) The field name for the time key.
|
31
|
+
- **time_format** (String. Optional) By default, the output format is iso8601 (e.g. “2008-02-01T21:41:49”). One can specify their own format with this parameter.
|
32
|
+
- **include_tag_key** (Boolean. Optional, defaults to false) If true, the tag field (as specified by the tag_key parameter) is kept in the record.
|
33
|
+
- **tag_key** (String, Optional, defaults to “tag”) The field name for the tag key.
|
34
|
+
- **localtime** (Boolean. Optional, defaults to true) If true, use local time. Otherwise, UTC is used. This parameter is overwritten by the utc parameter.
|
35
|
+
- **timezone** (String. Optional. v0.10.56 and above) By setting this parameter, one can parse the time value in the specified timezone. The following formats are accepted:
|
36
|
+
|
37
|
+
1. [+–]HH:MM (e.g. “+09:00”)
|
38
|
+
1. [+–]HHMM (e.g. “+0900”)
|
39
|
+
1. [+–]HH (e.g. “+09”)
|
40
|
+
1. Region/Zone (e.g. “Asia/Tokyo”)
|
41
|
+
1. Region/Zone/Zone (e.g. “America/Argentina/Buenos_Aires”)
|
42
|
+
|
43
|
+
The timezone set in this parameter takes precedence over localtime, e.g., if localtime is set to true but timezone is set to +0000, UTC would be used.
|
44
|
+
|
45
|
+
## ChangeLog
|
46
|
+
|
47
|
+
See [CHANGELOG.md](CHANGELOG.md) for details.
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
1. Fork it
|
52
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
53
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
54
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
55
|
+
5. Create new [Pull Request](../../pull/new/master)
|
56
|
+
|
57
|
+
## Copyright
|
58
|
+
|
59
|
+
Copyright (c) 2014 Naotoshi Seo. See [LICENSE](LICENSE) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rake/testtask'
|
5
|
+
desc 'Run test_unit based test'
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.test_files = Dir["test/**/test_*.rb"].sort
|
9
|
+
t.verbose = true
|
10
|
+
#t.warning = true
|
11
|
+
end
|
12
|
+
task :default => :test
|
13
|
+
|
14
|
+
desc 'Open an irb session preloaded with the gem library'
|
15
|
+
task :console do
|
16
|
+
sh 'irb -rubygems -I lib'
|
17
|
+
end
|
18
|
+
task :c => :console
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fluent-plugin-formatter_tsv"
|
6
|
+
s.version = "0.0.1"
|
7
|
+
s.authors = ["Naotoshi Seo"]
|
8
|
+
s.email = ["sonots@gmail.com"]
|
9
|
+
s.homepage = "https://github.com/sonots/fluent-plugin-formatter_tsv"
|
10
|
+
s.summary = "Fluentd TSV formatter plugin"
|
11
|
+
s.description = s.summary
|
12
|
+
s.licenses = ["MIT"]
|
13
|
+
|
14
|
+
s.rubyforge_project = "fluent-plugin-grep"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency "fluentd"
|
22
|
+
s.add_development_dependency "rake"
|
23
|
+
s.add_development_dependency "test-unit"
|
24
|
+
s.add_development_dependency "pry"
|
25
|
+
s.add_development_dependency "pry-nav"
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fluent
|
2
|
+
module TextFormatter
|
3
|
+
class TSVFormatter < Formatter
|
4
|
+
Plugin.register_formatter('tsv', self)
|
5
|
+
|
6
|
+
include Configurable # This enables the use of config_param
|
7
|
+
include HandleTagAndTimeMixin # If you wish to use tag_key, time_key, etc.
|
8
|
+
|
9
|
+
def configure(conf)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def format(tag, time, record)
|
14
|
+
"#{record.values.join("\t")}\n"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require 'fluent/formatter'
|
3
|
+
require 'fluent/plugin/formatter_tsv'
|
4
|
+
|
5
|
+
class TsvFormatterTest < ::Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@formatter = Fluent::Plugin.new_formatter('tsv')
|
8
|
+
@time = Fluent::Engine.now
|
9
|
+
end
|
10
|
+
|
11
|
+
def configure(conf)
|
12
|
+
@formatter.configure({'utc' => true}.merge(conf))
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_format
|
16
|
+
configure({})
|
17
|
+
tag = 'foo.test'
|
18
|
+
record = {"a" => "foo", "b" => "bar"}
|
19
|
+
|
20
|
+
formatted = @formatter.format(tag, @time, record)
|
21
|
+
assert_equal("foo\tbar\n", formatted)
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-formatter_tsv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Naotoshi Seo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-16 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: rake
|
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: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-nav
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Fluentd TSV formatter plugin
|
84
|
+
email:
|
85
|
+
- sonots@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- CHANGELOG.md
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- fluent-plugin-formatter_tsv.gemspec
|
98
|
+
- lib/fluent/plugin/formatter_tsv.rb
|
99
|
+
- test/helper.rb
|
100
|
+
- test/test_formatter_tsv.rb
|
101
|
+
homepage: https://github.com/sonots/fluent-plugin-formatter_tsv
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project: fluent-plugin-grep
|
121
|
+
rubygems_version: 2.2.2
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Fluentd TSV formatter plugin
|
125
|
+
test_files:
|
126
|
+
- test/helper.rb
|
127
|
+
- test/test_formatter_tsv.rb
|