fluent-plugin-docker-inspect 0.0.1 → 0.0.2

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: 3894563a74416e368a027c85681fd347740c4cbc
4
- data.tar.gz: 4be52cabe8ef9e9e3759a41388df8b2b1b37b4ae
3
+ metadata.gz: e464b4b66f5ea18153ea874c33f13efbacf886dc
4
+ data.tar.gz: db245ffbef8137ad09f37e3e88f6d5abec9a829d
5
5
  SHA512:
6
- metadata.gz: 260cf1c9c0ccbbc2efec16d4fcd1e7221ee4777ce8769fb8d60a96486b0dd38e32d991da6d52a85c7d2e6e12805b679ed5cd79bfecd699248b10d42424fb8599
7
- data.tar.gz: 4ae571c7de83ef84032df1104eb0fa438f886a3246288b0ddfcc8b16bdfcccb5bed933bb40a04a772a27e0e2db54ac4001c62428d3ad08bde74e956b2dbd020c
6
+ metadata.gz: 92ad1084a84924eb3f43d81df0edba9bc6e06347543d8338db1b5edff31366c150dcdb8be25c6284419322ed36ab42892f1c3b71c6625cf560a7fc98ef388bfe
7
+ data.tar.gz: aec437c71155986107008bc2fb105dc68e9ddd7303f13b25f7eca8326321cad1b3881d2356250c8b270d8e74033b47071be82cbc5533eb55df8ea4b34147b0b8
data/README.rst CHANGED
@@ -22,7 +22,7 @@ Configuration
22
22
  <source>
23
23
  type docker_inspect
24
24
  emit_interval 10
25
- tag "docker.#{Socket.gethostname}"
25
+ tag docker
26
26
  add_addr_tag yes
27
27
  </source>
28
28
 
@@ -35,6 +35,8 @@ docker_url
35
35
  specify docker_url if remote. ex: ``tcp://example.com:5422``. If docker runs local, no need to specify this param.
36
36
  add_addr_tag
37
37
  if specify some string such as 'yes', add local host ipv4 addr. (default: nil)
38
+ only_changed
39
+ if yes, only emit when docker inspect is changed.
38
40
 
39
41
  License
40
42
  ----------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -6,6 +6,8 @@ module Fluent
6
6
  config_param :docker_url, :string, :default => nil
7
7
  config_param :tag, :string, :default => nil
8
8
  config_param :add_addr_tag, :string, :default => nil
9
+ config_param :filter, :string, :default => nil
10
+ config_param :only_changed, :string, :default => nil
9
11
 
10
12
  unless method_defined?(:log)
11
13
  define_method(:log) { $log }
@@ -80,7 +82,11 @@ module Fluent
80
82
  tag = [tag, @host_addr].join(".")
81
83
  end
82
84
 
83
- get_inspect.each { | i |
85
+ inspect = get_inspect
86
+ if inspect.length == 0
87
+ return
88
+ end
89
+ inspect.each { | i |
84
90
  @es.add(time, i)
85
91
  }
86
92
  router.emit_stream(tag, @es)
@@ -97,7 +103,16 @@ module Fluent
97
103
  end
98
104
 
99
105
  def get_containers
100
- Docker::Container.all(:all => true)
106
+ begin
107
+ if @filter
108
+ Docker::Container.all(:all => true, :filters => @filter)
109
+ else
110
+ Docker::Container.all(:all => true)
111
+ end
112
+ rescue Exception => ex
113
+ @log.error ex
114
+ return []
115
+ end
101
116
  end
102
117
 
103
118
  def get_inspect
@@ -106,6 +121,10 @@ module Fluent
106
121
  get_containers.each { |c|
107
122
  result.push c.json
108
123
  }
124
+ if @only_changed && @last_inspect.to_s == result.to_s
125
+ return []
126
+ end
127
+ @last_inspect = result
109
128
 
110
129
  return result
111
130
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-docker-inspect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - WAKAYAMA Shirou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd