fluent-plugin-formatter_simple_tsv 0.0.1
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/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +9 -0
- data/fluent-plugin-formatter_simple_tsv.gemspec +25 -0
- data/lib/fluent/plugin/formatter_simple_tsv.rb +35 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f40757cafed0ca6877408dea9f34d22b26f1263b
|
4
|
+
data.tar.gz: 673073cfaf21896b99fa60ccff7eaa80708e68b8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d21ba0f2a268b8bcee705bb45602362930868c1ea4c02f891d34b5f86fe7f0cbf7bc57eb62ecfaea6c0ffa5705d8edc8bdf14be16b4dedb4f1412bdfaef905f2
|
7
|
+
data.tar.gz: 867bf1310741bb4ce285589cd87afad63419d471000d5e14e5defe376a8fcb8dcd61f3feae0140be66808e355aa7902a92d95f97d644b059447dbcd9151799c6
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Hiroshi Hatake
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Fluent::Plugin::FormatterSimpleTsv
|
2
|
+
|
3
|
+
Fluentd Simple TSV formatter plugin
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'fluent-plugin-formatter_simple_tsv'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install fluent-plugin-formatter_simple_tsv
|
20
|
+
|
21
|
+
## Configuration Example
|
22
|
+
|
23
|
+
Use out_xxx plugins which support Formatter feature together.
|
24
|
+
|
25
|
+
For example, for out_file plugin:
|
26
|
+
|
27
|
+
```
|
28
|
+
<match raw.**>
|
29
|
+
type file
|
30
|
+
path /tmp/tsv_test
|
31
|
+
format simple_tsv
|
32
|
+
</match>
|
33
|
+
```
|
34
|
+
## Parameters
|
35
|
+
|
36
|
+
- **keys** (String required) Specify "key1,key2,key3" format. This field is interpret ["key1", "key2", "key3"] internally. Only specified key's value will be formatted.
|
37
|
+
- **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.
|
38
|
+
- **time_key** (String, xOptional, defaults to “time”) The field name for the time key.
|
39
|
+
- **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.
|
40
|
+
- **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.
|
41
|
+
- **tag_key** (String, Optional, defaults to “tag”) The field name for the tag key.
|
42
|
+
- **localtime** (Boolean. Optional, defaults to true) If true, use local time. Otherwise, UTC is used. This parameter is overwritten by the utc parameter.
|
43
|
+
- **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:
|
44
|
+
|
45
|
+
1. [+–]HH:MM (e.g. “+09:00”)
|
46
|
+
1. [+–]HHMM (e.g. “+0900”)
|
47
|
+
1. [+–]HH (e.g. “+09”)
|
48
|
+
1. Region/Zone (e.g. “Asia/Tokyo”)
|
49
|
+
1. Region/Zone/Zone (e.g. “America/Argentina/Buenos_Aires”)
|
50
|
+
|
51
|
+
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.
|
52
|
+
|
53
|
+
## Development
|
54
|
+
|
55
|
+
After checking out the repo, run `bundle install` to install dependencies.
|
56
|
+
|
57
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it ( https://github.com/cosmo0920/fluent-plugin-formatter_simple_tsv/fork )
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
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-formatter_simple_tsv"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Hiroshi Hatake"]
|
9
|
+
spec.email = ["cosmo0920.oucc@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Fluentd Simple TSV formatter plugin"
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = "https://github.com/cosmo0920/fluent-plugin-formatter_simple_tsv"
|
14
|
+
spec.license = "MIT"
|
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 "fluentd", "0.12.10" # [">= 0.12.0", "< 2"]
|
22
|
+
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "test-unit", ">= 3.1.0"
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Fluent
|
2
|
+
module TextFormatter
|
3
|
+
class SimpleTsvFormatter < Formatter
|
4
|
+
Plugin.register_formatter('simple_tsv', self)
|
5
|
+
|
6
|
+
include Configurable
|
7
|
+
include HandleTagAndTimeMixin
|
8
|
+
|
9
|
+
config_param :keys, :default => [] do |val|
|
10
|
+
val.split(',')
|
11
|
+
end
|
12
|
+
|
13
|
+
def configure(conf)
|
14
|
+
super
|
15
|
+
|
16
|
+
if @keys.empty?
|
17
|
+
raise ConfigError, "keys option is required on simple_tsv formatter"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def format(tag, time, record)
|
22
|
+
selected = record.select {|key, val|
|
23
|
+
@keys.include?(key)
|
24
|
+
}
|
25
|
+
filter_record(tag, time, selected)
|
26
|
+
formatted = selected.inject('') { |result, pair|
|
27
|
+
result << "\t" if result.length.nonzero?
|
28
|
+
result << "#{pair.last}"
|
29
|
+
}
|
30
|
+
formatted << "\n"
|
31
|
+
formatted
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-formatter_simple_tsv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiroshi Hatake
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-08 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.12.10
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.12.10
|
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: rake
|
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: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.1.0
|
69
|
+
description: Fluentd Simple TSV formatter plugin
|
70
|
+
email:
|
71
|
+
- cosmo0920.oucc@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- fluent-plugin-formatter_simple_tsv.gemspec
|
83
|
+
- lib/fluent/plugin/formatter_simple_tsv.rb
|
84
|
+
homepage: https://github.com/cosmo0920/fluent-plugin-formatter_simple_tsv
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.4.5
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Fluentd Simple TSV formatter plugin
|
108
|
+
test_files: []
|