logstash-input-acquia 1.0.0 → 1.1.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: c22fe03d54ac77769ff0746ffeee14a47cd0e1f8
4
- data.tar.gz: 90d80d179d6bd2c7360cfeb1a941f8e06fac6fa7
3
+ metadata.gz: 7d1b41c923d3c2488a45aa8c0550fb13528c4133
4
+ data.tar.gz: 75f231cc490879d6cbe3992e16329e610f2658ff
5
5
  SHA512:
6
- metadata.gz: 9e105cd50d73d66184fc6c029481f6f00d261e601022952aeee3d15006c0cb5b8b5dd986d05055c2de7eea6a944995794c5bc5053b539565497ce10b531552eb
7
- data.tar.gz: e3ff62d7264d8242aea1df59b3d1ed43e92fbcb7fddb8ef2b01e582197e8cdd9fdba14c12eab6767b29931a6111aeff5da7cb7901c25c5af1af779a8260b43cc
6
+ metadata.gz: 001cce6e944a33dae032d8b3c52b8b15a1089e4853c2490269f5af62958761dd54d469a0fb7f54c63b73d07333e07847b6cc822e022af8d0613789e5ba94502c
7
+ data.tar.gz: db4160c507a28839f4d43cc4818687a626f84c90f1539bff7dbe436c2e4c7d959474efc9e6e528dbb285eb4c77bd8d44221d7928058f88ec866645b522c075aa
@@ -20,23 +20,24 @@ class LogStash::Inputs::Acquia < LogStash::Inputs::Base
20
20
  def register
21
21
  @cloud = ::Acquia::Cloud.new(:credentials => "#{@username}:#{@api_key}")
22
22
  @site = @cloud.site(@site)
23
- @streams = @environments.map do |env|
23
+ @streams = {}
24
+ @environments.each do |env|
24
25
  @logger.info "Opening log stream for #{env}."
25
26
  stream = @site.environment(env).logstream
26
27
  @types.each do |type|
27
28
  stream.enable_type type
28
29
  end
29
30
  stream.connect
30
- stream
31
+ @streams[env] = stream
31
32
  end
32
33
  end
33
34
 
34
35
  def run(queue)
35
36
  Stud.interval(1) do
36
- @streams.each do |env|
37
- env.each_log do |log|
37
+ @streams.each do |env, stream|
38
+ stream.each_log do |log|
38
39
  # p log
39
- queue << generate_event(log)
40
+ queue << generate_event(env, log)
40
41
  end
41
42
  end
42
43
  end
@@ -50,13 +51,17 @@ class LogStash::Inputs::Acquia < LogStash::Inputs::Base
50
51
  end
51
52
 
52
53
  private
53
- def generate_event(log)
54
+ def generate_event(env, log)
54
55
  # Remove useless cruft.
55
56
  log.delete 'cmd'
56
- # Rename some of Acquia's parameters to more relevant Logstash names
57
+ # Save the environment this message is coming from.
58
+ log['[acquia][site]'] = @site.name
59
+ log['[acquia][environment]'] = env
60
+ # Rename some of Acquia's parameters to more relevant Logstash names.
57
61
  log['host'] = log.delete('server')
58
62
  log['message'] = log.delete('text')
59
63
  log['@timestamp'] = Time.parse(log.delete('disp_time') + ' +0000').iso8601
64
+
60
65
  LogStash::Event.new(log)
61
66
  end
62
67
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'logstash-input-acquia'
4
- s.version = '1.0.0'
4
+ s.version = '1.1.0'
5
5
  s.licenses = ['MIT']
6
6
  s.summary = 'Logstash Input plugin that streams logs from Acquia Cloud'
7
7
  s.description = 'This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-acquia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Equiem