fluent-plugin-switch 0.0.3 → 0.0.4

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: 375462655a08f8ef77144082cd2ad68ec9d570f2
4
- data.tar.gz: f04a864cf6bfc005eb4da08ce767b240da1cddee
3
+ metadata.gz: b297194b0ca8aaa1bf9c836bdc9b50b4f16c9f68
4
+ data.tar.gz: 06f78d7a121561054788263a5d9c6bc76de4db97
5
5
  SHA512:
6
- metadata.gz: 3453365983bc5196a3a11baba83488e3d79d4de061ba5b0944b8fdcf607b8bbccf52572cfb9b6c7d58aba7a94c8af4ed0bef311fa5e6794779a8a7fef0e97fea
7
- data.tar.gz: 09076acb75e9d7009dacbcc2de2736e2ba120383b97af8de74d8f93e662887d1c00ae984b295c0c57471d7a7fa648ef82826536d2aa84beea1f8af7a4e454d7d
6
+ metadata.gz: a3cb5d88d0e85b85e5791b2782ab75d7aaf97b97aaf9fadc8ced011ba098633e9d6e6f8b038bd2aa371a91a19f79926472a2d3d1d8b520ad5f39fef13d44c34a
7
+ data.tar.gz: d15e10c63bc357a3375300dd6854f8ad670a0fdfc63b896d52f526603b18891c980a0ab1bc38c302f2022afd91d4725a95fd6bb8b2f08d01d6f6efd289e25a0a
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "fluent-plugin-switch"
6
- gem.version = "0.0.3"
6
+ gem.version = "0.0.4"
7
7
  gem.date = '2017-08-08'
8
8
  gem.authors = ["Arash Vatanpoor"]
9
9
  gem.email = ["arash@a-venture.org"]
@@ -32,7 +32,6 @@ class Fluent::AddFilter < Fluent::Filter
32
32
  raise Fluent::ConfigError, "use 'condtion' key for pattern matching, and use 'value' key for replacement value"
33
33
  end
34
34
  end
35
- # puts @list
36
35
  end
37
36
 
38
37
  # method to remap based the conditions in the config
@@ -45,7 +44,6 @@ class Fluent::AddFilter < Fluent::Filter
45
44
  payload = array.join(',')
46
45
  else
47
46
  keys = key_space.split(',')
48
- # puts keys
49
47
  if keys.all? {|elem| record.key? elem}
50
48
  keys.each do |key|
51
49
  payload = payload + record[key]
@@ -65,16 +63,24 @@ class Fluent::AddFilter < Fluent::Filter
65
63
 
66
64
 
67
65
  def filter(tag, time, record)
68
- value = revalue(record)
69
- if action == 'append'
70
- record = record.merge!(category_name => value)
71
- else
72
- if record.has_key? category_name
73
- record[category_name] = value
66
+ pass_thru = record
67
+ begin
68
+ value = revalue(record)
69
+ if action == 'append'
70
+ record = record.merge!(category_name => value)
74
71
  else
75
- raise Fluent::ConfigError, "can't find the key in record to replace its value"
72
+ if record.has_key? category_name
73
+ record[category_name] = value
74
+ else
75
+ raise Fluent::ConfigError, "can't find the key in record to replace its value"
76
+ end
76
77
  end
78
+ rescue Exception => e
79
+ log.error e.message
80
+ log.error e.backtrace.inspect
81
+ log.info 'an exception occurred while filtering, returning the original record'
82
+ return pass_thru
77
83
  end
78
- return record
84
+ record
79
85
  end
80
- end
86
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-switch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arash Vatanpoor