fluent-plugin-rewrite-tag-filter 1.1.0 → 1.1.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.
data/README.rdoc
CHANGED
@@ -23,7 +23,7 @@ user-agent, request-uri, regex-backreference and so on with regular expression.
|
|
23
23
|
rewruterule<num:1-200> <attribute> <regex_pattern> <new_tag>
|
24
24
|
|
25
25
|
# Optional: Capitalize every matched regex backreference. (ex: $1, $2)
|
26
|
-
capitalize_regex_backreference <yes/no(default)
|
26
|
+
capitalize_regex_backreference <yes/no> (default no)
|
27
27
|
|
28
28
|
=== Usage
|
29
29
|
|
@@ -89,12 +89,26 @@ On starting td-agent, Logging supported like below.
|
|
89
89
|
|
90
90
|
=== Tag placeholder
|
91
91
|
|
92
|
-
Supporing these placeholder for
|
92
|
+
Supporing these placeholder for new_tag(rewrited tag).
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
- ${hostname}
|
95
|
+
- __HOSTNAME__
|
96
|
+
- ${tag}
|
97
|
+
- __TAG__
|
98
|
+
|
99
|
+
It's a sample to rewrite a tag with placeholder.
|
100
|
+
|
101
|
+
# It will get "rewrited.apache.access.ExampleMail"
|
102
|
+
<match apache.access>
|
103
|
+
type rewrite_tag_filter
|
104
|
+
rewriterule1 domain ^(mail)\.(example)\.com$ rewrited.${tag}.$2$1
|
105
|
+
</match>
|
106
|
+
|
107
|
+
# It will get "rewrited.ExampleMail.app30-124.foo.com" when hostname is "app30-124.foo.com"
|
108
|
+
<match apache.access>
|
109
|
+
type rewrite_tag_filter
|
110
|
+
rewriterule1 domain ^(mail)\.(example)\.com$ rewrited.$2$1.${hostname}
|
111
|
+
</match>
|
98
112
|
|
99
113
|
== Example
|
100
114
|
|
@@ -112,6 +126,9 @@ Supporing these placeholder for rewrite tag.
|
|
112
126
|
- Fluentd & TreasureDataで こっそり始めるログ集計 Fluentd Meetup #2 @mikeda
|
113
127
|
- http://www.slideshare.net/baguzy/fluentd-meetup-2-14073930
|
114
128
|
|
129
|
+
- 似てる #fluentd プラグインの比較
|
130
|
+
- http://matsumana.wordpress.com/2012/11/15/%E4%BC%BC%E3%81%A6%E3%82%8B-fluentd-%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%81%AE%E6%AF%94%E8%BC%83/
|
131
|
+
|
115
132
|
== TODO
|
116
133
|
|
117
134
|
- patches welcome!
|
@@ -3,12 +3,11 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-rewrite-tag-filter"
|
6
|
-
s.version = "1.1.
|
6
|
+
s.version = "1.1.1"
|
7
7
|
s.authors = ["Kentaro Yoshida"]
|
8
8
|
s.email = ["y.ken.studio@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/y-ken/fluent-plugin-rewrite-tag-filter"
|
10
|
-
s.summary = %q{Fluentd Output filter plugin. It has designed to rewrite tag like mod_rewrite. Also you can change a tag from apache log by domain, status-code(ex. 500 error), user-agent, request-uri, regex-backreference and so on with regular expression.}
|
11
|
-
# s.description = %q{Fluentd Output filter plugin. It has designed to rewrite tag like mod_rewrite. Also you can change a tag from apache log by domain, status-code(ex. 500 error), user-agent, and request-uri and so on with regular expression.}
|
10
|
+
s.summary = %q{Fluentd Output filter plugin. It has designed to rewrite tag like mod_rewrite. Re-emmit a record with rewrited tag when a value matches with the regular expression. Also you can change a tag with a values from apache log by domain, status-code(ex. 500 error), user-agent, request-uri, regex-backreference and so on with regular expression.}
|
12
11
|
|
13
12
|
s.files = `git ls-files`.split("\n")
|
14
13
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -44,7 +44,7 @@ class Fluent::RewriteTagFilterOutput < Fluent::Output
|
|
44
44
|
es.each do |time,record|
|
45
45
|
rewrite = false
|
46
46
|
@rewriterules.each do |index, rewritekey, regexp, rewritetag|
|
47
|
-
rewritevalue = record[rewritekey]
|
47
|
+
rewritevalue = record[rewritekey].to_s
|
48
48
|
next if rewritevalue.nil?
|
49
49
|
next unless (regexp && regexp.match(rewritevalue))
|
50
50
|
backreference_table = map_regex_table($~.captures)
|
@@ -68,6 +68,7 @@ class Fluent::RewriteTagFilterOutput < Fluent::Output
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def map_regex_table(elements)
|
71
|
+
# TODO: use each.with_index http://shirusu-ni-tarazu.hatenablog.jp/entry/2012/11/04/173513
|
71
72
|
hash_table = Hash.new
|
72
73
|
index = 1
|
73
74
|
elements.each do |value|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-rewrite-tag-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: fluentd
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
description:
|
37
47
|
email:
|
38
48
|
- y.ken.studio@gmail.com
|
@@ -71,12 +81,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
81
|
version: '0'
|
72
82
|
requirements: []
|
73
83
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.8.
|
84
|
+
rubygems_version: 1.8.23
|
75
85
|
signing_key:
|
76
86
|
specification_version: 3
|
77
87
|
summary: Fluentd Output filter plugin. It has designed to rewrite tag like mod_rewrite.
|
78
|
-
|
79
|
-
|
88
|
+
Re-emmit a record with rewrited tag when a value matches with the regular expression.
|
89
|
+
Also you can change a tag with a values from apache log by domain, status-code(ex.
|
90
|
+
500 error), user-agent, request-uri, regex-backreference and so on with regular
|
91
|
+
expression.
|
80
92
|
test_files:
|
81
93
|
- test/helper.rb
|
82
94
|
- test/plugin/test_out_rewrite_tag_filter.rb
|