fluent-plugin-switch 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-switch.gemspec +1 -1
- data/lib/fluent/plugin/filter_switch.rb +17 -11
- 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: b297194b0ca8aaa1bf9c836bdc9b50b4f16c9f68
|
4
|
+
data.tar.gz: 06f78d7a121561054788263a5d9c6bc76de4db97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3cb5d88d0e85b85e5791b2782ab75d7aaf97b97aaf9fadc8ced011ba098633e9d6e6f8b038bd2aa371a91a19f79926472a2d3d1d8b520ad5f39fef13d44c34a
|
7
|
+
data.tar.gz: d15e10c63bc357a3375300dd6854f8ad670a0fdfc63b896d52f526603b18891c980a0ab1bc38c302f2022afd91d4725a95fd6bb8b2f08d01d6f6efd289e25a0a
|
@@ -32,7 +32,6 @@ class Fluent::AddFilter < Fluent::Filter
|
|
32
32
|
raise Fluent::ConfigError, "use 'condtion' key for pattern matching, and use 'value' key for replacement value"
|
33
33
|
end
|
34
34
|
end
|
35
|
-
# puts @list
|
36
35
|
end
|
37
36
|
|
38
37
|
# method to remap based the conditions in the config
|
@@ -45,7 +44,6 @@ class Fluent::AddFilter < Fluent::Filter
|
|
45
44
|
payload = array.join(',')
|
46
45
|
else
|
47
46
|
keys = key_space.split(',')
|
48
|
-
# puts keys
|
49
47
|
if keys.all? {|elem| record.key? elem}
|
50
48
|
keys.each do |key|
|
51
49
|
payload = payload + record[key]
|
@@ -65,16 +63,24 @@ class Fluent::AddFilter < Fluent::Filter
|
|
65
63
|
|
66
64
|
|
67
65
|
def filter(tag, time, record)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
record[category_name] = value
|
66
|
+
pass_thru = record
|
67
|
+
begin
|
68
|
+
value = revalue(record)
|
69
|
+
if action == 'append'
|
70
|
+
record = record.merge!(category_name => value)
|
74
71
|
else
|
75
|
-
|
72
|
+
if record.has_key? category_name
|
73
|
+
record[category_name] = value
|
74
|
+
else
|
75
|
+
raise Fluent::ConfigError, "can't find the key in record to replace its value"
|
76
|
+
end
|
76
77
|
end
|
78
|
+
rescue Exception => e
|
79
|
+
log.error e.message
|
80
|
+
log.error e.backtrace.inspect
|
81
|
+
log.info 'an exception occurred while filtering, returning the original record'
|
82
|
+
return pass_thru
|
77
83
|
end
|
78
|
-
|
84
|
+
record
|
79
85
|
end
|
80
|
-
end
|
86
|
+
end
|