logstash-input-acquia 1.5.0 → 1.6.0

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: 5c541c11c86f158df9742931c69d883ea49259bd
4
- data.tar.gz: dddc1fd2a2ede13cd34a8ddb1b2d7fa4d82d746d
3
+ metadata.gz: 9436f4cd00f374d9089a65020fd587e6b7b244d5
4
+ data.tar.gz: 3d4ca97ba2ce0dec8a66a94b17a2c058319a2466
5
5
  SHA512:
6
- metadata.gz: da0d0f7d7bfa94fb6df97e8971f125d40922314ea5b666b8e580bae9677ccd9a5419a9d618c878b319ccb58038a021b6968b61d0c425495922d7818edb8a51bd
7
- data.tar.gz: 27fddfbfedea6d867581ce0feaaea97735d3445fef7df24b4a48567e60eaed1007766d362ad71a72a7f4422bcba6e3813a6058c8ce228de5911d1285b2590a79
6
+ metadata.gz: d0e439f17026d6e6d4b049942778512100fa2c77e0a21ba2ef593197cbee3a4ca2549b605042d1ce90bc4ba4d81b8b5b192884216db05ab13211e3893df49531
7
+ data.tar.gz: 81600a01b0fddc4498af121452502462f74fdfa47362741a5e6d307e7ca5aee0fb3053a6b98ab9a1edcf20e5af97fe6279043ed098d3ae1688788fcede15e6b8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.6.0
@@ -16,31 +16,32 @@ class LogStash::Inputs::Acquia < LogStash::Inputs::Base
16
16
  config :site, :validate => :string, :required => true
17
17
  config :environments, :validate => :array, :default => ['prod']
18
18
  config :types, :validate => :array, :default => ['drupal-watchdog', 'php-error']
19
+ config :interval, :validate => :number, :default => 5
20
+ config :debug, :validate => :boolean, :default => false
19
21
 
20
22
  public
21
23
  def register
22
24
  @cloud = ::Acquia::Cloud.new(:credentials => "#{@username}:#{@api_key}")
23
- @site = @cloud.site(@site)
24
- @streams = {}
25
- @environments.each do |env|
26
- @logger.info "Opening log stream for #{env}."
27
- stream = @site.environment(env).logstream
28
- @types.each do |type|
29
- stream.enable_type type
30
- end
31
- stream.connect
32
- @streams[env] = stream
33
- end
25
+ @acsite = @cloud.site(@site)
34
26
  end
35
27
 
36
28
  def run(queue)
37
- Stud.interval(1) do
29
+ @streams = {}
30
+ @environments.each do |env|
31
+ @streams[env] = get_stream(env)
32
+ end
33
+ Stud.interval(@interval) do
38
34
  @streams.each do |env, stream|
39
- stream.each_log do |log|
40
- # p log
41
- event = generate_event(env, log)
42
- decorate(event)
43
- queue << event
35
+ begin
36
+ stream.each_log do |log|
37
+ # p log
38
+ event = generate_event(env, log)
39
+ decorate(event)
40
+ queue << event
41
+ end
42
+ rescue Errno::EPIPE
43
+ @logger.warn("Detected a broken pipe for #{env} on #{@site}, reconnecting.")
44
+ @streams[env] = get_stream(env)
44
45
  end
45
46
  end
46
47
  end
@@ -54,13 +55,25 @@ class LogStash::Inputs::Acquia < LogStash::Inputs::Base
54
55
  end
55
56
 
56
57
  private
58
+ def get_stream(env)
59
+ @logger.info "Opening log stream for #{env}."
60
+ stream = @acsite.environment(env).logstream
61
+ @types.each do |type|
62
+ stream.enable_type type
63
+ end
64
+ stream.keepalive_duration = @interval * 2
65
+ stream.debug if @debug
66
+ stream.connect
67
+ stream
68
+ end
69
+
57
70
  def generate_event(env, log)
58
71
  # Remove useless API cruft.
59
72
  log.delete 'cmd'
60
73
 
61
74
  # Save the environment this message is coming from.
62
75
  log['acquia'] = {
63
- 'site' => @site.name,
76
+ 'site' => @acsite.name,
64
77
  'environment' => env,
65
78
  }
66
79
 
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_runtime_dependency 'logstash-core', '~> 1.5'
21
21
  s.add_runtime_dependency 'logstash-codec-plain'
22
22
  s.add_runtime_dependency 'stud'
23
- s.add_runtime_dependency 'acquia-cloud', '>= 0.1.2', '< 2.0.0'
23
+ s.add_runtime_dependency 'acquia-cloud', '>= 0.2.1', '< 2.0.0'
24
24
 
25
25
  s.add_development_dependency 'logstash-devutils'
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-acquia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Equiem
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  requirements:
58
58
  - - '>='
59
59
  - !ruby/object:Gem::Version
60
- version: 0.1.2
60
+ version: 0.2.1
61
61
  - - <
62
62
  - !ruby/object:Gem::Version
63
63
  version: 2.0.0
@@ -68,7 +68,7 @@ dependencies:
68
68
  requirements:
69
69
  - - '>='
70
70
  - !ruby/object:Gem::Version
71
- version: 0.1.2
71
+ version: 0.2.1
72
72
  - - <
73
73
  - !ruby/object:Gem::Version
74
74
  version: 2.0.0