fluent-plugin-mqtt-io 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 436c90bc08f8b1c25114bbfd1974bd0ba3c07e70
4
- data.tar.gz: 449febe8ba31c88d42735d59552c97b6761230e2
3
+ metadata.gz: a101da6ec1e37ea4d06abcdb86de0d197e9b3a61
4
+ data.tar.gz: 133378382d856ed7a71fed8d2ebb45da077d7091
5
5
  SHA512:
6
- metadata.gz: d89f5f8e965131ad174c26581cfe75ae603ff6e310e4591184eaf2b0d066b020e522f88375db75f6a482c783289d71f61c39957c2037932cf9ad8b5f181eb023
7
- data.tar.gz: 3afd42160d9329e3b1f9f380ac48f1e54e10e90aaa454e3ef9b931d57fc77d3c7176c364800a52d1cb39ed8bf0526dcd7970d69f0d9c72dfd97dd54c87b703c6
6
+ metadata.gz: 4257209a7c1dc3f66632c25cab3467c565bac14676d274fbc78430f1f8b9790c4c4e33777383ba489537ac20dccd085639b621483fe8391224a564c20cdc2233
7
+ data.tar.gz: 2704c441daa69f016a2486dffd3b70947b0e0077d5eb3fc45c36f62076acbafc3d2586c3c065d8fa93a8dba2986541e3c31a1fa6df24ed5f06be4d58ba5d1f40
data/README.md CHANGED
@@ -68,7 +68,8 @@ Output Plugin can be used via match directive.
68
68
 
69
69
  The options are basically the same as Input Plugin. The difference is the following.
70
70
 
71
- - time_key: An attribute name used for timestamp field. Default is 'timestamp'.
71
+ - time_key: An attribute name used for timestamp field genarated from fluentd time field. Default is nil (omitted).
72
+ If this option is omitted, timestamp field is not appended to the output record.
72
73
  - time_format: Output format of timestamp field. Default is ISO8601. You can specify your own format by using TimeParser.
73
74
  - topic_rewrite_pattern: Regexp pattern to extract replacement words from received topic or tag name
74
75
  - topic_rewrite_replacement: Topic name used for the publish using extracted pattern
@@ -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-mqtt-io"
7
- spec.version = "0.0.2"
7
+ spec.version = "0.0.3"
8
8
  spec.authors = ["Toyokazu Akiyama"]
9
9
  spec.email = ["toyokazu@gmail.com"]
10
10
 
@@ -12,7 +12,7 @@ module Fluent
12
12
  base.config_param :ca_file, :string, :default => nil
13
13
  base.config_param :key_file, :string, :default => nil
14
14
  base.config_param :cert_file, :string, :default => nil
15
- base.config_param :time_key, :string, :default => 'timestamp'
15
+ base.config_param :time_key, :string, :default => nil
16
16
  base.config_param :time_format, :string, :default => nil
17
17
  base.config_param :topic_rewrite_pattern, :string, :default => nil
18
18
  base.config_param :topic_rewrite_replacement, :string, :default => nil
@@ -72,6 +72,14 @@ module Fluent
72
72
  end
73
73
  end
74
74
 
75
+ def timestamp_hash(time)
76
+ if @time_key.nil?
77
+ {}
78
+ else
79
+ {@time_key => format_time(time)}
80
+ end
81
+ end
82
+
75
83
  def rewrite_tag(tag)
76
84
  if @topic_rewrite_pattern.nil?
77
85
  tag.gsub("\.", "/")
@@ -10,7 +10,7 @@ module Fluent
10
10
  def emit(tag, es, chain)
11
11
  es.each {|time,record|
12
12
  $log.debug "#{tag}, #{format_time(time)}, #{record}"
13
- @connect.publish(rewrite_tag(tag), record.merge(@time_key => format_time(time)).to_json)
13
+ @connect.publish(rewrite_tag(tag), record.merge(timestamp_hash(time)).to_json)
14
14
  }
15
15
  $log.flush
16
16
 
@@ -23,7 +23,7 @@ module Fluent
23
23
  def write(chunk)
24
24
  json = json_parse(chunk.read)
25
25
  $log.debug "#{json[0]}, #{format_time(json[1])}, #{json[2]}"
26
- @connect.publish(rewrite_tag(json[0]), (json[2].merge(@time_key => format_time(json[1]))).to_json)
26
+ @connect.publish(rewrite_tag(json[0]), (json[2].merge(timestamp_hash(json[1]))).to_json)
27
27
  $log.flush
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-mqtt-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toyokazu Akiyama
8
8
  autorequire:
9
9
  bindir: []
10
10
  cert_chain: []
11
- date: 2015-11-05 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler