fluent-plugin-fluent-plugin-json-size-limit 0.1.12 → 0.1.13
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f85063944aafffc112ca219ae7705c6c018a81b6e175485a251e65f17f3ae3d
|
4
|
+
data.tar.gz: 4fe2c449138e030ec02aa7ede0165ca72639779b5c5808c01987d517e14e9e32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9601a42974d8b16e6a30f47dbc2b51b16a7036fc4eafac8ffcb031a412327cb4ad695c4ab37cd94446a8a7f7f5428917f6bcc52e0ad82b4dabbd910243ecc41
|
7
|
+
data.tar.gz: c1f50d76c81a7dec05381f214c3eaad103930f6b17ac3b08c0a4285e3f3578e7af6604d4ffebafaa3b36929461602ce17d09c62726080df222477deaf62c3f72
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "fluent-plugin-fluent-plugin-json-size-limit"
|
6
|
-
spec.version = "0.1.
|
6
|
+
spec.version = "0.1.13"
|
7
7
|
spec.authors = ["Mykola Panin"]
|
8
8
|
spec.email = ["mykola.panin@creatoriq.com"]
|
9
9
|
|
@@ -22,9 +22,11 @@ module Fluent
|
|
22
22
|
|
23
23
|
def configure(conf)
|
24
24
|
super
|
25
|
+
log.debug "Configuring JsonSizeLimitFilter"
|
25
26
|
end
|
26
27
|
|
27
28
|
def filter(tag, time, record)
|
29
|
+
log.debug "Original record: #{record.to_json.bytesize} bytes"
|
28
30
|
json_str = record.to_json
|
29
31
|
while json_str.bytesize > 250 * 1024
|
30
32
|
sorted_fields = record.sort_by { |k, v| v.to_s.length }.reverse
|
@@ -43,15 +45,16 @@ module Fluent
|
|
43
45
|
json_str = record.to_json
|
44
46
|
if json_str.bytesize <= 250 * 1024
|
45
47
|
reduced = true
|
48
|
+
log.debug "Reduced size of field '#{key}' to fit size limit"
|
46
49
|
break
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
50
53
|
break unless reduced
|
54
|
+
log.debug "Record reduced: #{json_str.bytesize} bytes"
|
51
55
|
end
|
52
56
|
record
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
57
|
-
|