fluent-plugin-multiprocess 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjMyZjczODc2OThlMzRmYWEyZDAzM2ZjMDQxZDZjYTM3MWI2NTQ3ZA==
5
- data.tar.gz: !binary |-
6
- MzQ1ZTUyOGE3NTdhMDE1NTkyODM0YjZkOWZjOGVlNDBjMTFlNzg0Nw==
2
+ SHA1:
3
+ metadata.gz: e48192b877aec8789d3f5b8cf783809230b04995
4
+ data.tar.gz: e5a6014ced8cc68e46dfb46e1d7a9cf46ec8ea11
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- N2YyM2Q2MmNlNWM3ZmQ3ZTJjOWRjODRkZjZmNjcwYWExZDE2YTY2MjYzMjgz
10
- MWZlOThiMDdiZTZhOTljMjhhM2EyYjhjYjkzMjhkMjEyNjgzM2NlMTFkMjMx
11
- OGU5MjA3ZGRmN2EyN2Q0OTliNTQ3MjA3NTg3Y2YxMzMyYmJhN2I=
12
- data.tar.gz: !binary |-
13
- NDZiZTZiZDk2ZjU3NGFhMzg3MTk3NmU4ZDU4YjFhZjA2ZjgwYWRjMGJjMzY5
14
- M2E3MjlmZmZhYjk2Mzk5ZDEyNzFjOWE5ZmNhMzY4MWY5ODVjYTM5MmRmYjJk
15
- OGQ5MDQ5ODEyNGY3YTg3NWZkMmIyZDkwNTA4NjU4NTRjODYxYWE=
6
+ metadata.gz: 3188545bc5a4d78367f297a6d37ebddead7051c24e54b3774b9a08bb339c131013454af251bd40bbd0d0c6a5fd329153ae8eb2b45b339dae1a13f53f06561ec0
7
+ data.tar.gz: 6ae0935a863b11210207409e7fc430a15018e0785ea0714ab540528449a61c734cfa54e91791254a753d744781e86afec072a913927e4870aed3d6c3e7c0bb2c
data/README.md CHANGED
@@ -20,20 +20,27 @@ This plugin just controls start & shutdown of child processes.
20
20
  #graceful_kill_timeout 60s
21
21
 
22
22
  <process>
23
- cmdline -c /etc/fluent/fluentd_child1.conf
23
+ cmdline -c /etc/fluent/fluentd_child1.conf --log /var/log/fluent/fluentd_child1.log
24
+ pid_file /var/run/fluentd_child1.pid
24
25
  </process>
25
26
  <process>
26
- cmdline -c /etc/fluent/fluentd_child2.conf
27
+ cmdline -c /etc/fluent/fluentd_child2.conf --log /var/log/fluent/fluentd_child2.log
27
28
  sleep_before_start 5s
29
+ pid_file /var/run/fluentd_child2.pid
28
30
  </process>
29
31
  <process>
30
- cmdline -c /etc/fluent/fluentd_child3.conf
32
+ cmdline -c /etc/fluent/fluentd_child3.conf --log /var/log/fluent/fluentd_child3.log
31
33
  sleep_before_shutdown 5s
34
+ pid_file /var/run/fluentd_child3.pid
32
35
  </process>
33
36
  </source>
34
37
 
35
- - **process** section sets command line arguments of a child process. This plugin creates one child process for each \<process\> section
36
- - **cmdline** option is required in a \<process\> section
37
- - **sleep\_before\_start** sets wait time before starting the process. Note that child processes **start from last to first** (`fluentd_child3` -\> `sleep 5` -\> { `fluentd_child2`, `fluentd_child1` } in this case)
38
- - **sleep\_before\_shutdown** sets wait time before shutting down the process. Note that child processes **shutdown from first to last** ({ `fluentd_child1`, `fluentd_child2` } -\> `sleep 5` -> `fluentd_child3` in this case)
38
+ - **process**: section sets command line arguments of a child process. This plugin creates one child process for each \<process\> section
39
+ - **cmdline**: This parameter is required in a \<process\> section
40
+ - **sleep\_before\_start**: Optional. Sets wait time before starting the process. Note that child processes **start from last to first** (`fluentd_child3` -\> `sleep 5` -\> { `fluentd_child2`, `fluentd_child1` } in this case)
41
+ - **sleep\_before\_shutdown**: Optional. Sets wait time before shutting down the process. Note that child processes **shutdown from first to last** ({ `fluentd_child1`, `fluentd_child2` } -\> `sleep 5` -> `fluentd_child3` in this case)
42
+ - **pid_file**: Optional. Writes child process id to this file. This is useful for sending a signal to child processes.
39
43
 
44
+ ### Logs for daemonized processes
45
+
46
+ Daemonized fluentd closes its STDOUT. So child processes on daemonized fluentd & in_multiprocess doesn't put its logs without `--log` option. Specifing `--log` option always is best practice to help this situation.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ['lib']
18
18
  gem.license = "Apache 2.0"
19
19
 
20
- gem.add_dependency "fluentd", [">= 0.10.0", "< 0.13.0"]
21
- gem.add_dependency "serverengine", "~> 1.5.5"
20
+ gem.add_dependency "fluentd", [">= 0.10.0", "< 2"]
21
+ gem.add_dependency "serverengine", "~> 1.6"
22
22
  gem.add_development_dependency "rake", ">= 0.9.2"
23
23
  end
@@ -35,6 +35,7 @@ module Fluent
35
35
  config_param :sleep_before_start, :time, :default => 0
36
36
  config_param :sleep_before_shutdown, :time, :default => 0
37
37
  config_param :keep_file_descriptors, :bool, :default => nil
38
+ config_param :pid_file, :string, :default => nil
38
39
 
39
40
  attr_accessor :process_monitor
40
41
  end
@@ -72,6 +73,8 @@ module Fluent
72
73
  keep_file_descriptors = pe.keep_file_descriptors.nil? ? @keep_file_descriptors : pe.keep_file_descriptors
73
74
  options = {:close_others => !keep_file_descriptors}
74
75
  pe.process_monitor = @pm.spawn(cmd, options)
76
+
77
+ create_pid_file(pe) if pe.pid_file
75
78
  end
76
79
  end
77
80
 
@@ -84,6 +87,19 @@ module Fluent
84
87
  @processes.each {|pe|
85
88
  pe.process_monitor.join
86
89
  }
90
+ @processes.each { |pe|
91
+ delete_pid_file(pe) if pe.pid_file
92
+ }
93
+ end
94
+
95
+ def create_pid_file(pe)
96
+ File.open(pe.pid_file, "w") { |f|
97
+ f.write pe.process_monitor.pid
98
+ }
99
+ end
100
+
101
+ def delete_pid_file(pe)
102
+ File.unlink(pe.pid_file) if File.exist?(pe.pid_file)
87
103
  end
88
104
  end
89
105
 
metadata CHANGED
@@ -1,61 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-multiprocess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2016-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.10.0
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 0.13.0
22
+ version: '2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ! '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.10.0
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 0.13.0
32
+ version: '2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: serverengine
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ~>
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 1.5.5
39
+ version: '1.6'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ~>
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 1.5.5
46
+ version: '1.6'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ! '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 0.9.2
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ! '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 0.9.2
61
61
  description: Multiprocess agent plugin for Fluentd event collector
@@ -82,12 +82,12 @@ require_paths:
82
82
  - lib
83
83
  required_ruby_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ! '>='
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - ! '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
@@ -97,4 +97,3 @@ signing_key:
97
97
  specification_version: 4
98
98
  summary: Multiprocess agent plugin for Fluentd event collector
99
99
  test_files: []
100
- has_rdoc: false