fluent-plugin-filter-list 0.2.1 → 0.2.3

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
  SHA1:
3
- metadata.gz: c0ca7201c3b19c329300cacaaebcf63e22eb0f9e
4
- data.tar.gz: 0f68e79ac937846b90f3bd3112d14ed497855b81
3
+ metadata.gz: c163b0f7d168334069d8bc723d9e73ac4c660d0a
4
+ data.tar.gz: 5e21a35184419bacd65223f9e586a66fc91cdac7
5
5
  SHA512:
6
- metadata.gz: ebd5661935b0c935536eed16a178c5025d103c5e1763b45a6e38461560599053bbddf287120541af154dfbc141cdf620fa6f8ead72cccda56741f5f7dd3ca341
7
- data.tar.gz: f032bd4fda10f499fdd0bbe022011694b0274b999b98931be94e7b6d57bf740167b5561febb18957b70675844888fc7ea46f240702f260eec35e524308393cba
6
+ metadata.gz: 17d90e1e42ccb07028e7380382827fb297f25ae7c4de7d8ee523da86f1e65e90c161a1c696585220366e76ec92a8f7fd758fceda6329e3fadecf19a0a2595f08
7
+ data.tar.gz: b47dee18b5ed637d33b914e7d729f640598253bd2c6a197f0c1eef2131811c420478bbce4e1293523bac747da222a5c7dade5f7e5a3bd1a96f34454ce897590e
@@ -0,0 +1,24 @@
1
+ require 'fluent/plugin/out_filter_list/version'
2
+ require 'aho_corasick'
3
+
4
+ module Fluent
5
+ class FilterListFilter < Filter
6
+ include Matchers
7
+
8
+ Plugin.register_filter('filter_list', self)
9
+
10
+ config_param :key_to_filter, :string, :default => nil
11
+ config_param :patterns_file_path, :string, :default => ''
12
+
13
+ def configure(conf)
14
+ super
15
+ patterns = @patterns_file_path.empty? ? [] : File.readlines(@patterns_file_path).map(&:chomp).reject(&:empty?)
16
+ @matcher = ACMatcher.new(patterns)
17
+ end
18
+
19
+ def filter(_tag, _time, record)
20
+ target = record[@key_to_filter]
21
+ target && @matcher.matches?(target) ? nil : record
22
+ end
23
+ end
24
+ end
@@ -47,20 +47,24 @@ module Fluent
47
47
  if @retag && @retag.add_prefix
48
48
  @prefix = @retag.add_prefix + "."
49
49
  end
50
+ log.debug "prefix: #{@prefix}, prefix_for_filtered_tag: #{@prefix_for_filtered_tag}"
50
51
  end
51
52
 
52
53
  def emit(tag, es, chain)
53
54
  es.each do |time, record|
54
55
  target = record[@key_to_filter]
56
+ log.debug "target: #{target}"
55
57
  # Do filter
56
58
  if target && @matcher.matches?(target)
57
59
  if @retag_for_filtered
58
60
  tag = @retag_for_filtered.tag || ((tag && !tag.empty?) ? @prefix_for_filtered_tag + tag : @retag_for_filtered.add_prefix)
61
+ log.debug "re-emit with tag: #{tag}"
59
62
  router.emit(tag, time, record)
60
63
  end
61
64
  next
62
65
  end
63
66
  tag = @retag.tag || ((tag && !tag.empty?) ? @prefix + tag : @retag.add_prefix)
67
+ log.debug "re-emit with tag: #{tag}"
64
68
  router.emit(tag, time, record)
65
69
  end
66
70
  end
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
  module OutFilterList
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-filter-list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shun Yanaura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-11 00:00:00.000000000 Z
11
+ date: 2017-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -104,6 +104,7 @@ files:
104
104
  - bin/setup
105
105
  - fluent-plugin-out_filter_list.gemspec
106
106
  - lib/aho_corasick.rb
107
+ - lib/fluent/plugin/filter_filter_list.rb
107
108
  - lib/fluent/plugin/out_filter_list.rb
108
109
  - lib/fluent/plugin/out_filter_list/version.rb
109
110
  homepage: https://github.com/yanana/fluent-plugin-filter-list