fluent-plugin-filter-object-flatten 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/fluent/plugin/filter_object_flatten.rb +12 -0
- data/lib/fluent_plugin_filter_object_flatten/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59dcecf84b047f37b27e20f9f2f074f8664a8264
|
4
|
+
data.tar.gz: aa75d348ef841f95a796236763bc232a3488a504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b195f7a32780018565ef553cf94e605670d40109fa83cb89cfd0d4f4ded051e41131b1eaf10bd9120f4227d3140bae75e12c9f859303f0a947938c448977c01
|
7
|
+
data.tar.gz: 1753d9ca765569b475f909036e1fa8c5f858ddd7fa271076c7c6ff9f17497333a82df335df4d496d614510488af48b2cfe2ff53d2dd7b56cac3765aa757c426c
|
data/README.md
CHANGED
@@ -23,11 +23,13 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
$ gem install fluent-plugin-filter-object-flatten
|
25
25
|
|
26
|
+
## Configuration
|
26
27
|
|
27
28
|
```apache
|
28
29
|
<filter>
|
29
|
-
type
|
30
|
+
type object_flatten
|
30
31
|
#separator .
|
32
|
+
#tr [" /", "__"]
|
31
33
|
</filter>
|
32
34
|
```
|
33
35
|
|
@@ -6,12 +6,24 @@ module Fluent
|
|
6
6
|
Plugin.register_filter('object_flatten', self)
|
7
7
|
|
8
8
|
config_param :separator, :string, :default => '.'
|
9
|
+
config_param :tr, :array, :default => []
|
9
10
|
|
10
11
|
def filter_stream(tag, es)
|
11
12
|
result_es = Fluent::MultiEventStream.new
|
12
13
|
|
13
14
|
es.each do |time, record|
|
14
15
|
ObjectFlatten.flatten(record, @separator).each do |new_record|
|
16
|
+
unless @tr.empty?
|
17
|
+
new_record_with_tr = {}
|
18
|
+
|
19
|
+
new_record.each do |key, value|
|
20
|
+
key = key.tr(*@tr)
|
21
|
+
new_record_with_tr[key] = value
|
22
|
+
end
|
23
|
+
|
24
|
+
new_record = new_record_with_tr
|
25
|
+
end
|
26
|
+
|
15
27
|
result_es.add(time, new_record)
|
16
28
|
end
|
17
29
|
end
|