fluent-plugin-rewrite 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +30 -0
- data/fluent-plugin-rewrite.gemspec +1 -1
- data/lib/fluent/plugin/out_rewrite.rb +5 -1
- data/test/plugin/test_out_rewrite.rb +18 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -37,6 +37,12 @@ matching and re-emit them.
|
|
37
37
|
append_to_tag true
|
38
38
|
fallback others
|
39
39
|
</rule>
|
40
|
+
<rule>
|
41
|
+
key is_loggged_in
|
42
|
+
pattern 1
|
43
|
+
append_to_tag true
|
44
|
+
tag user
|
45
|
+
</rule>
|
40
46
|
</match>
|
41
47
|
```
|
42
48
|
|
@@ -145,6 +151,30 @@ This time, the messabe above will be re-emmited as the message below:
|
|
145
151
|
apache.log.others { "path" : "/foo/bar" }
|
146
152
|
```
|
147
153
|
|
154
|
+
If `tag` option set,
|
155
|
+
|
156
|
+
```
|
157
|
+
<rule>
|
158
|
+
key is_loggged_in
|
159
|
+
pattern 1
|
160
|
+
append_to_tag true
|
161
|
+
tag user
|
162
|
+
</rule>
|
163
|
+
```
|
164
|
+
|
165
|
+
the value designated by `tag` will be appended to the original tag, that is:
|
166
|
+
|
167
|
+
|
168
|
+
```
|
169
|
+
test { "is_logged_in" => "1" }
|
170
|
+
```
|
171
|
+
|
172
|
+
will be
|
173
|
+
|
174
|
+
```
|
175
|
+
test.user { "is_logged_in" => "1" }
|
176
|
+
```
|
177
|
+
|
148
178
|
### rule: last
|
149
179
|
|
150
180
|
If you set `last` option to true, rewriting chain stops applying rule where the pattern matches first.
|
@@ -140,6 +140,24 @@ class RewriteOutputTest < Test::Unit::TestCase
|
|
140
140
|
[ "test.others", { "path" => "/unmatched/path" } ],
|
141
141
|
d2.instance.rewrite("test", { "path" => "/unmatched/path" })
|
142
142
|
)
|
143
|
+
|
144
|
+
d3 = create_driver(%[
|
145
|
+
<rule>
|
146
|
+
key is_logged_in
|
147
|
+
pattern 1
|
148
|
+
append_to_tag true
|
149
|
+
tag user
|
150
|
+
</rule>
|
151
|
+
])
|
152
|
+
|
153
|
+
assert_equal(
|
154
|
+
[ "test.user", { "is_logged_in" => "1" } ],
|
155
|
+
d3.instance.rewrite("test", { "is_logged_in" => "1" })
|
156
|
+
)
|
157
|
+
assert_equal(
|
158
|
+
[ "test", { "is_logged_in" => "0" } ],
|
159
|
+
d3.instance.rewrite("test", { "is_logged_in" => "0" })
|
160
|
+
)
|
143
161
|
end
|
144
162
|
|
145
163
|
def test_last
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-rewrite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|