fluent-plugin-redis-enrichment 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -0
- data/fluent-plugin-redis-enrichment.gemspec +1 -1
- data/lib/fluent/plugin/filter_redis_enrichment.rb +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dce02b1a565f23110f893fba038783b7232983d
|
4
|
+
data.tar.gz: a4c841da7abd957e0d3f55a5646ea77f1fcc4b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca960d09e87abc9ed82b36626afe1f2b707f7c6458f3d8d43e51c4e63bb881b65bcd87ba4539462905a05125b084e08b8ef5521ff856f120250c354c67dd641f
|
7
|
+
data.tar.gz: c9dcac0989a3f3d440ee6fb1cf50c4056e8393c9a08d356e0771064ab9ffa0b8f663f1b34fb8f17a426aff7793a9b7f59257a026ac1da9bb22d45a91dcc424e8
|
data/README.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
Filter plugin that allow to update record with data fetch from redis.
|
4
4
|
|
5
|
+
## Behaviour
|
6
|
+
|
7
|
+
- try to do record enrichment using redis content,
|
8
|
+
- fetch redis data based on a key that can be hardcoded or in the record
|
9
|
+
- enrich record with redis fetched data
|
10
|
+
- in case of failure in the processing, skip enrichment and let processing
|
11
|
+
continue on record
|
12
|
+
|
5
13
|
## Installation
|
6
14
|
|
7
15
|
|
@@ -15,9 +23,19 @@ Add to Gemfile with:
|
|
15
23
|
|
16
24
|
## Compatibility
|
17
25
|
|
26
|
+
### 1.x.x
|
27
|
+
|
28
|
+
plugin in 1.x.x will work with:
|
18
29
|
- ruby >= 2.4.10
|
19
30
|
- td-agent >= 3.8.1-0
|
20
31
|
|
32
|
+
and so use:
|
33
|
+
- redis > 4, < 5
|
34
|
+
|
35
|
+
### 2.x.x
|
36
|
+
|
37
|
+
will come next !
|
38
|
+
|
21
39
|
## Configuration
|
22
40
|
|
23
41
|
### template
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'fluent-plugin-redis-enrichment'
|
8
|
-
spec.version = '1.0.
|
8
|
+
spec.version = '1.0.2'
|
9
9
|
spec.authors = ['Thomas Tych']
|
10
10
|
spec.email = ['thomas.tych@gmail.com']
|
11
11
|
|
@@ -29,7 +29,9 @@ module Fluent
|
|
29
29
|
# filter plugin
|
30
30
|
# enrich record based on redis fetched content
|
31
31
|
class RedisEnrichmentFilter < Fluent::Plugin::Filter
|
32
|
-
|
32
|
+
NAME = 'redis_enrichment'
|
33
|
+
|
34
|
+
Fluent::Plugin.register_filter(NAME, self)
|
33
35
|
|
34
36
|
DEFAULT_REDIS_HOST = '127.0.0.1'
|
35
37
|
DEFAULT_REDIS_PORT = 6379
|
@@ -117,7 +119,7 @@ module Fluent
|
|
117
119
|
expanded_key = @placeholder_expander.expand(@key, { tag: tag,
|
118
120
|
time: time,
|
119
121
|
record: new_record })
|
120
|
-
log.debug("
|
122
|
+
log.debug("filter #{NAME}: on tag:#{tag}, search #{expanded_key}")
|
121
123
|
redis = @cache.get(expanded_key)
|
122
124
|
new_record_record_enrichment = @placeholder_expander.expand(@record_enrichment,
|
123
125
|
{ tag: tag,
|
@@ -125,6 +127,9 @@ module Fluent
|
|
125
127
|
record: new_record,
|
126
128
|
redis: redis })
|
127
129
|
new_record.merge(new_record_record_enrichment)
|
130
|
+
rescue StandardError => e
|
131
|
+
log.error("filter #{NAME}: skip enrichment due to error: #{e}")
|
132
|
+
record
|
128
133
|
end
|
129
134
|
|
130
135
|
def cache_options
|
@@ -319,7 +324,7 @@ module Fluent
|
|
319
324
|
@redis ||= ConnectionPool::Wrapper.new(size: @pool_size, timeout: @timeout) do
|
320
325
|
if @sentinels
|
321
326
|
Redis.new(sentinels: @sentinels, name: @name, role: @role, db: @db, password: @password,
|
322
|
-
timeout: @timeout)
|
327
|
+
timeout: @timeout, host: @name)
|
323
328
|
else
|
324
329
|
Redis.new(host: @host, port: @port, db: @db, password: @password, timeout: @timeout)
|
325
330
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-redis-enrichment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Tych
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bump
|