fluent-plugin-druid-log 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/fluent/plugin/filter_format_druid_audit_log_2.rb +18 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03cefeccb950407624b4d8a1ee951dbe6215ee56bb056f64da066cbaae65a328
|
|
4
|
+
data.tar.gz: '094fb5516873e69625f81d7eea7555385204efd1ab7f88b27a6a11fe4175398f'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ddd623c7d9bcd74e0dcee79b5fd0654ad611f82fce8fe61cb80678213e9bd144b00014b06ec30d9ca1ecd3683a0b397690f4480b036e2e3ccf26e682ded96559
|
|
7
|
+
data.tar.gz: e08b2383eff5fe14d0293cec3a9104df5028146c518e9cc7b97bceb93254c6695371610041df78f337142952948349a0b59e74a2e51a69a1ba7861dd9e825907
|
|
@@ -38,7 +38,9 @@ module Fluent
|
|
|
38
38
|
|
|
39
39
|
def format_record(record)
|
|
40
40
|
[query_key, query_result_key].each do |key|
|
|
41
|
-
|
|
41
|
+
if record[key].is_a? String
|
|
42
|
+
record[key] = record[key].size > 0 ? JSON.parse(record[key]) : {}
|
|
43
|
+
end
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
query_type = guess_query_type(record)
|
|
@@ -59,9 +61,22 @@ module Fluent
|
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
def fix_record_query_granularity(record)
|
|
62
|
-
|
|
64
|
+
update_all_key_value(record, 'granularity') do |value|
|
|
65
|
+
value.to_s unless value.nil?
|
|
66
|
+
end
|
|
67
|
+
end
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
def update_all_key_value(record, key, &block)
|
|
70
|
+
record.each do |rkey, rvalue|
|
|
71
|
+
if rkey.to_s == key
|
|
72
|
+
record[rkey] = yield(rvalue) if block_given?
|
|
73
|
+
next
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if rvalue.is_a?(Hash)
|
|
77
|
+
update_all_key_value(rvalue, key, &block)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
65
80
|
end
|
|
66
81
|
end
|
|
67
82
|
end
|