logstash-input-acquia 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/LICENSE +19 -0
- data/Rakefile +0 -0
- data/lib/logstash/inputs/acquia.rb +62 -0
- data/logstash-input-acquia.gemspec +27 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c22fe03d54ac77769ff0746ffeee14a47cd0e1f8
|
4
|
+
data.tar.gz: 90d80d179d6bd2c7360cfeb1a941f8e06fac6fa7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e105cd50d73d66184fc6c029481f6f00d261e601022952aeee3d15006c0cb5b8b5dd986d05055c2de7eea6a944995794c5bc5053b539565497ce10b531552eb
|
7
|
+
data.tar.gz: e3ff62d7264d8242aea1df59b3d1ed43e92fbcb7fddb8ef2b01e582197e8cdd9fdba14c12eab6767b29931a6111aeff5da7cb7901c25c5af1af779a8260b43cc
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
jruby
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Matthew Scharley
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
+
copy of this software and associated documentation files (the "Software"),
|
5
|
+
to deal in the Software without restriction, including without limitation
|
6
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
8
|
+
Software is furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included
|
11
|
+
in all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
14
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
19
|
+
DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'time'
|
3
|
+
require 'logstash/inputs/base'
|
4
|
+
require 'logstash/namespace'
|
5
|
+
require 'stud/interval'
|
6
|
+
require 'acquia/cloud'
|
7
|
+
|
8
|
+
class LogStash::Inputs::Acquia < LogStash::Inputs::Base
|
9
|
+
config_name 'acquia'
|
10
|
+
|
11
|
+
default :codec, 'plain'
|
12
|
+
|
13
|
+
config :username, :validate => :string, :required => true
|
14
|
+
config :api_key, :validate => :string, :required => true
|
15
|
+
config :site, :validate => :string, :required => true
|
16
|
+
config :environments, :validate => :array, :default => ['prod']
|
17
|
+
config :types, :validate => :array, :default => ['drupal-watchdog', 'php-error']
|
18
|
+
|
19
|
+
public
|
20
|
+
def register
|
21
|
+
@cloud = ::Acquia::Cloud.new(:credentials => "#{@username}:#{@api_key}")
|
22
|
+
@site = @cloud.site(@site)
|
23
|
+
@streams = @environments.map do |env|
|
24
|
+
@logger.info "Opening log stream for #{env}."
|
25
|
+
stream = @site.environment(env).logstream
|
26
|
+
@types.each do |type|
|
27
|
+
stream.enable_type type
|
28
|
+
end
|
29
|
+
stream.connect
|
30
|
+
stream
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def run(queue)
|
35
|
+
Stud.interval(1) do
|
36
|
+
@streams.each do |env|
|
37
|
+
env.each_log do |log|
|
38
|
+
# p log
|
39
|
+
queue << generate_event(log)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def stop
|
46
|
+
@logger.info 'Closing log streams.'
|
47
|
+
@streams.each do |stream|
|
48
|
+
stream.close
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def generate_event(log)
|
54
|
+
# Remove useless cruft.
|
55
|
+
log.delete 'cmd'
|
56
|
+
# Rename some of Acquia's parameters to more relevant Logstash names
|
57
|
+
log['host'] = log.delete('server')
|
58
|
+
log['message'] = log.delete('text')
|
59
|
+
log['@timestamp'] = Time.parse(log.delete('disp_time') + ' +0000').iso8601
|
60
|
+
LogStash::Event.new(log)
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = 'logstash-input-acquia'
|
4
|
+
s.version = '1.0.0'
|
5
|
+
s.licenses = ['MIT']
|
6
|
+
s.summary = 'Logstash Input plugin that streams logs from Acquia Cloud'
|
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'
|
8
|
+
s.authors = ['Equiem']
|
9
|
+
s.email = 'sysadmin@equiem.com.au'
|
10
|
+
s.homepage = 'http://www.elastic.co/guide/en/logstash/current/index.html'
|
11
|
+
|
12
|
+
s.files = `git ls-files -z`.split("\x0")
|
13
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
|
+
s.test_files = s.files.grep(%r{^spec/})
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
|
17
|
+
# Special flag to let us know this is actually a logstash plugin
|
18
|
+
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
19
|
+
|
20
|
+
# Gem dependencies
|
21
|
+
s.add_runtime_dependency 'logstash-core', '~> 1.5'
|
22
|
+
s.add_runtime_dependency 'logstash-codec-plain'
|
23
|
+
s.add_runtime_dependency 'stud'
|
24
|
+
s.add_runtime_dependency 'acquia-cloud', '>= 0.1.2', '< 2.0.0'
|
25
|
+
|
26
|
+
s.add_development_dependency 'logstash-devutils'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-input-acquia
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Equiem
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ~>
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.5'
|
19
|
+
name: logstash-core
|
20
|
+
prerelease: false
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
name: logstash-codec-plain
|
34
|
+
prerelease: false
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
name: stud
|
48
|
+
prerelease: false
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.1.2
|
61
|
+
- - <
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 2.0.0
|
64
|
+
name: acquia-cloud
|
65
|
+
prerelease: false
|
66
|
+
type: :runtime
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.1.2
|
72
|
+
- - <
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.0.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
name: logstash-devutils
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
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
|
90
|
+
email: sysadmin@equiem.com.au
|
91
|
+
executables: []
|
92
|
+
extensions: []
|
93
|
+
extra_rdoc_files: []
|
94
|
+
files:
|
95
|
+
- .gitignore
|
96
|
+
- .ruby-version
|
97
|
+
- Gemfile
|
98
|
+
- LICENSE
|
99
|
+
- Rakefile
|
100
|
+
- lib/logstash/inputs/acquia.rb
|
101
|
+
- logstash-input-acquia.gemspec
|
102
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata:
|
106
|
+
logstash_plugin: 'true'
|
107
|
+
logstash_group: input
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.4.5
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Logstash Input plugin that streams logs from Acquia Cloud
|
128
|
+
test_files: []
|