fluent-plugin-simple-to-hash 0.0.1 → 0.0.2
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/Gemfile +4 -0
- data/fluent-plugin-simple-to-hash.gemspec +1 -1
- data/lib/fluent/plugin/filter_simple2hash.rb +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db6969ec89476303be5876874b6ebe7208a210d
|
4
|
+
data.tar.gz: 4449385acd6ab8239e0a1253d2eec17f412a95fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60984981e941008c61614eb375f653b82c3e152b9c78b4ddf81923010b0eb42150f39d63be65e05a41df8d69d2a4cb0509c59e76807a47fc083dce1128ca3330
|
7
|
+
data.tar.gz: d8a6e1957c7d5ffc4a2a545ae5a420108e793ed0e1e8d80e3c1da68be06e9ddb87425f897ad3ad0b49ae749147581096e1dcbba06ca86af2d1b9cfa1f642e914
|
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-simple-to-hash"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["Augusto Nishi"]
|
9
9
|
spec.email = ["augusto.nishi@gmail.com"]
|
10
10
|
spec.summary = %q{fluentd filter plugin for converting simple variable to hash}
|
@@ -1,8 +1,19 @@
|
|
1
1
|
module Fluent
|
2
2
|
class Simple2hash < Filter
|
3
|
+
Plugin.register_filter('simple2hash', self)
|
4
|
+
|
5
|
+
config_param :var, :string, :default => 'value'
|
6
|
+
|
7
|
+
def configure(conf)
|
8
|
+
super
|
9
|
+
@var ||= conf['var']
|
10
|
+
end
|
11
|
+
|
3
12
|
def filter(tag, time, record)
|
4
13
|
if record.is_a?(Numeric) or record.is_a?(Array) or record.is_a?(String)
|
5
|
-
|
14
|
+
obj = Hash.new
|
15
|
+
obj[@var] = record
|
16
|
+
return obj
|
6
17
|
else
|
7
18
|
return record
|
8
19
|
end
|