fluent-plugin-redis-store-wejick 0.0.7 → 0.0.8
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/README.md +6 -1
- data/fluent-plugin-redis-store-wejick.gemspec +3 -3
- data/lib/fluent/plugin/out_redis_store_wejick.rb +19 -36
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70737670280e0eeb33bb3563447e49d4a775496b
|
4
|
+
data.tar.gz: 41f7932b44117c1fc7bcf1e1575d176307afaadf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144e9b8ac10e86e241bdb749bf9e6c6df1abeb7a2e455974ed885be7c19a631a1ac48de94a0cb95f2c4fe034062166346a5bc2cee4948d34f884c7155e20ba76
|
7
|
+
data.tar.gz: 7c095e45d1a9aa869cebe6768b9eac8ce2c53788cba8311acdc63b6ae9bde039c94bac9ace51a0ba198d2aa8855c219e6dc82d51b136318b3a5fccce7bf7741a
|
data/README.md
CHANGED
@@ -127,7 +127,7 @@ No more options than common options.
|
|
127
127
|
| `prevent_duplicate` | (0,1) | 0 | Prevent duplicated value in one key (list) |
|
128
128
|
| `string_tolow` | (0,1) | 0 | value to lowercase |
|
129
129
|
| `string_unescape` | (0,1) | 0 | unescape value |
|
130
|
-
| `string_unescape_twice` | (0,1) | 0 |
|
130
|
+
| `string_unescape_twice` | (0,1) | 0 | in you need another unescape |
|
131
131
|
| `value_length` | (0,1) | list trimming doesn't honor ordering |
|
132
132
|
|
133
133
|
### `set` storage specific options
|
@@ -140,6 +140,11 @@ No more options than common options.
|
|
140
140
|
| :---- | :----- | :----------------------- | :------------ |
|
141
141
|
| `score_path` | string | (_time_ of log event) | path to lookup for _score_ in the event data |
|
142
142
|
| `value_expire` | int | | value expiration in seconds |
|
143
|
+
| `prevent_duplicate` | (0,1) | 0 | Prevent duplicated value in one key (list) |
|
144
|
+
| `string_tolow` | (0,1) | 0 | value to lowercase |
|
145
|
+
| `string_unescape` | (0,1) | 0 | unescape value |
|
146
|
+
| `string_unescape_twice` | (0,1) | 0 | in you need another unescape |
|
147
|
+
| `value_length` | (0,1) | z trimming doesn't honor ordering |
|
143
148
|
|
144
149
|
If `value_expire` is set, the plugin assumes that the _score_ in the **SortedSet** is
|
145
150
|
based on *timestamp* and it deletes expired _members_ every after new event data arrives.
|
@@ -2,11 +2,11 @@
|
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = "fluent-plugin-redis-store-wejick"
|
4
4
|
gem.email = "wejick@gmail.com"
|
5
|
-
gem.version = "0.0.
|
5
|
+
gem.version = "0.0.8"
|
6
6
|
gem.authors = ["wejick", "Gian Giovani"]
|
7
7
|
gem.licenses = ["Apache-2.0"]
|
8
|
-
gem.summary = %q{Redis(zset/set/list/string/publish) output plugin for Fluentd
|
9
|
-
gem.description = %q{Redis(zset/set/list/string/publish) output plugin for Fluentd
|
8
|
+
gem.summary = %q{Redis(zset/set/list/string/publish) output plugin for Fluentd}
|
9
|
+
gem.description = %q{Redis(zset/set/list/string/publish) output plugin for Fluentd...}
|
10
10
|
gem.homepage = "https://github.com/wejick/fluent-plugin-redis-store"
|
11
11
|
|
12
12
|
gem.files = `git ls-files`.split($\)
|
@@ -97,6 +97,23 @@ module Fluent
|
|
97
97
|
key = get_key_from(record)
|
98
98
|
value = get_value_from(record)
|
99
99
|
score = get_score_from(record, time)
|
100
|
+
|
101
|
+
if 0 < @string_tolow
|
102
|
+
value = lower_string(value)
|
103
|
+
end
|
104
|
+
if 0 < @string_unescape
|
105
|
+
value = unescape_string(value)
|
106
|
+
if 0 <@string_unescape_twice
|
107
|
+
value = unescape_string(value)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
if 0 < @only_alphanumeric
|
111
|
+
if ( /^[a-zA-Z0-9 ]*$/.match(value) ) != nil
|
112
|
+
else
|
113
|
+
return
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
100
117
|
@redis.zadd key, score, value
|
101
118
|
|
102
119
|
set_key_expire key
|
@@ -105,8 +122,8 @@ module Fluent
|
|
105
122
|
@redis.zremrangebyscore key , '-inf' , (now - @value_expire)
|
106
123
|
end
|
107
124
|
if 0 < @value_length
|
108
|
-
|
109
|
-
@redis.
|
125
|
+
l = -1 - @value_length
|
126
|
+
@redis.zremrangebyrank key, 0, l
|
110
127
|
end
|
111
128
|
end
|
112
129
|
|
@@ -173,40 +190,6 @@ module Fluent
|
|
173
190
|
return string
|
174
191
|
end
|
175
192
|
|
176
|
-
def generate_zremrangebyrank_script(key, maxlen, order)
|
177
|
-
script = "local key = '" + key.to_s + "'\n"
|
178
|
-
script += "local maxlen = " + maxlen.to_s + "\n"
|
179
|
-
script += "local order ='" + order.to_s + "'\n"
|
180
|
-
script += "local len = tonumber(redis.call('ZCOUNT', key, '-inf', '+inf'))\n"
|
181
|
-
script += "if len > maxlen then\n"
|
182
|
-
script += " if order == 'asc' then\n"
|
183
|
-
script += " local l = len - maxlen\n"
|
184
|
-
script += " if l >= 0 then\n"
|
185
|
-
script += " return redis.call('ZREMRANGEBYRANK', key, 0, l)\n"
|
186
|
-
script += " end\n"
|
187
|
-
script += " else\n"
|
188
|
-
script += " return redis.call('ZREMRANGEBYRANK', key, maxlen, -1)\n"
|
189
|
-
script += " end\n"
|
190
|
-
script += "end\n"
|
191
|
-
return script
|
192
|
-
end
|
193
|
-
|
194
|
-
def generate_ltrim_script(key, maxlen, order)
|
195
|
-
script = "local key = '" + key.to_s + "'\n"
|
196
|
-
script += "local maxlen = " + maxlen.to_s + "\n"
|
197
|
-
script += "local order ='" + order.to_s + "'\n"
|
198
|
-
script += "local len = tonumber(redis.call('LLEN', key))\n"
|
199
|
-
script += "if len > maxlen then\n"
|
200
|
-
script += " if order == 'asc' then\n"
|
201
|
-
script += " local l = len - maxlen\n"
|
202
|
-
script += " return redis.call('LTRIM', key, l, -1)\n"
|
203
|
-
script += " else\n"
|
204
|
-
script += " return redis.call('LTRIM', key, 0, maxlen - 1)\n"
|
205
|
-
script += " end\n"
|
206
|
-
script += "end\n"
|
207
|
-
return script
|
208
|
-
end
|
209
|
-
|
210
193
|
def traverse(data, key)
|
211
194
|
val = data
|
212
195
|
key.split('.').each{ |k|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-redis-store-wejick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wejick
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -67,8 +67,7 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
-
description: Redis(zset/set/list/string/publish) output plugin for Fluentd
|
71
|
-
process to adding more functionality (not stable)...
|
70
|
+
description: Redis(zset/set/list/string/publish) output plugin for Fluentd...
|
72
71
|
email: wejick@gmail.com
|
73
72
|
executables: []
|
74
73
|
extensions: []
|
@@ -102,11 +101,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
101
|
version: '0'
|
103
102
|
requirements: []
|
104
103
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.4.8
|
106
105
|
signing_key:
|
107
106
|
specification_version: 4
|
108
|
-
summary: Redis(zset/set/list/string/publish) output plugin for Fluentd
|
109
|
-
contains config breaking change)
|
107
|
+
summary: Redis(zset/set/list/string/publish) output plugin for Fluentd
|
110
108
|
test_files:
|
111
109
|
- test/helpers.rb
|
112
110
|
- test/plugin/test_out_redis_publish.rb
|