logstash-input-couchdb_changes 2.0.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +12 -3
- data/lib/logstash/inputs/couchdb_changes.rb +17 -9
- data/logstash-input-couchdb_changes.gemspec +3 -3
- metadata +26 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f3fdca5f52dae99daa286e1d4a41f8c0b3dd149
|
4
|
+
data.tar.gz: 3f36078df3ade055cf391fb5823d1cd3d6b49d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f6446c6bfe974b4305efc260b05285b2bf386a5acd08f36696fa50d06b38d743748d9a543012b850edc661b0bca6c2d5368b13a36916cd3077eddd1a76ce8da
|
7
|
+
data.tar.gz: 0071f765ba7890b18805790c4cc49f03816a183d930704a30bfff3f4301ee654a542161af2cb6feee4ddff3fcf66f4b8084e73e752d677d04cd8c6c17104b077
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
## 3.0.0
|
2
|
+
- Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
|
1
3
|
# 2.0.4
|
2
4
|
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
|
3
5
|
# 2.0.3
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
[![Build
|
4
|
-
Status](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Inputs/job/logstash-plugin-input-couchdb_changes-unit/badge/icon)](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Inputs/job/logstash-plugin-input-couchdb_changes-unit/)
|
3
|
+
[![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-input-couchdb_changes.svg)](https://travis-ci.org/logstash-plugins/logstash-input-couchdb_changes)
|
5
4
|
|
6
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
7
6
|
|
@@ -56,7 +55,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
|
56
55
|
```
|
57
56
|
- Install plugin
|
58
57
|
```sh
|
58
|
+
# Logstash 2.3 and higher
|
59
|
+
bin/logstash-plugin install --no-verify
|
60
|
+
|
61
|
+
# Prior to Logstash 2.3
|
59
62
|
bin/plugin install --no-verify
|
63
|
+
|
60
64
|
```
|
61
65
|
- Run Logstash with your plugin
|
62
66
|
```sh
|
@@ -74,7 +78,12 @@ gem build logstash-filter-awesome.gemspec
|
|
74
78
|
```
|
75
79
|
- Install the plugin from the Logstash home
|
76
80
|
```sh
|
77
|
-
|
81
|
+
# Logstash 2.3 and higher
|
82
|
+
bin/logstash-plugin install --no-verify
|
83
|
+
|
84
|
+
# Prior to Logstash 2.3
|
85
|
+
bin/plugin install --no-verify
|
86
|
+
|
78
87
|
```
|
79
88
|
- Start Logstash and proceed to test the plugin
|
80
89
|
|
@@ -138,6 +138,7 @@ class LogStash::Inputs::CouchDBChanges < LogStash::Inputs::Base
|
|
138
138
|
buffer = FileWatch::BufferedTokenizer.new
|
139
139
|
@logger.info("Connecting to CouchDB _changes stream at:", :host => @host.to_s, :port => @port.to_s, :db => @db)
|
140
140
|
uri = build_uri
|
141
|
+
@logger.info("Using service uri :", :uri => uri)
|
141
142
|
until stop?
|
142
143
|
begin
|
143
144
|
Net::HTTP.start(@host, @port, :use_ssl => (@secure == true), :ca_file => @ca_file) do |http|
|
@@ -145,7 +146,10 @@ class LogStash::Inputs::CouchDBChanges < LogStash::Inputs::Base
|
|
145
146
|
request = Net::HTTP::Get.new(uri.request_uri)
|
146
147
|
request.basic_auth(@username, @password.value) if @username && @password
|
147
148
|
http.request request do |response|
|
148
|
-
raise ArgumentError, "
|
149
|
+
raise ArgumentError, :message => "Server error!", :response_code => response.code if response.code >= "500"
|
150
|
+
raise ArgumentError, :message => "Authentication error!", :response_code => response.code if response.code == "401"
|
151
|
+
raise ArgumentError, :message => "Database not found!", :response_code => response.code if response.code == "404"
|
152
|
+
raise ArgumentError, :message => "Request error!", :response_code => response.code if response.code >= "400"
|
149
153
|
response.read_body do |chunk|
|
150
154
|
buffer.extract(chunk).each do |changes|
|
151
155
|
# Put a "stop" check here. If we stop here, anything we've read, but
|
@@ -190,27 +194,31 @@ class LogStash::Inputs::CouchDBChanges < LogStash::Inputs::Base
|
|
190
194
|
|
191
195
|
private
|
192
196
|
def reconnect?
|
193
|
-
Stud.stoppable_sleep(@
|
197
|
+
Stud.stoppable_sleep(@reconnect_delay) if @always_reconnect
|
194
198
|
@always_reconnect
|
195
199
|
end
|
196
200
|
|
197
201
|
private
|
198
|
-
def build_event(
|
202
|
+
def build_event(changes)
|
199
203
|
# In lieu of a codec, build the event here
|
200
|
-
|
201
|
-
return nil if
|
204
|
+
data = LogStash::Json.load(changes)
|
205
|
+
return nil if data.has_key?("last_seq")
|
206
|
+
if data['doc'].nil?
|
207
|
+
logger.debug("doc is nil", :data => data)
|
208
|
+
return nil
|
209
|
+
end
|
202
210
|
hash = Hash.new
|
203
|
-
hash['@metadata'] = { '_id' =>
|
204
|
-
if
|
211
|
+
hash['@metadata'] = { '_id' => data['doc']['_id'] }
|
212
|
+
if data['doc']['_deleted']
|
205
213
|
hash['@metadata']['action'] = 'delete'
|
206
214
|
else
|
207
|
-
hash['doc'] =
|
215
|
+
hash['doc'] = data['doc']
|
208
216
|
hash['@metadata']['action'] = 'update'
|
209
217
|
hash['doc'].delete('_id')
|
210
218
|
hash['doc_as_upsert'] = true
|
211
219
|
hash['doc'].delete('_rev') unless @keep_revision
|
212
220
|
end
|
213
|
-
hash['@metadata']['seq'] =
|
221
|
+
hash['@metadata']['seq'] = data['seq']
|
214
222
|
event = LogStash::Event.new(hash)
|
215
223
|
@logger.debug("event", :event => event.to_hash_with_metadata) if @logger.debug?
|
216
224
|
event
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-couchdb_changes'
|
4
|
-
s.version = '
|
4
|
+
s.version = '3.0.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This input captures the _changes stream from a CouchDB instance"
|
7
|
-
s.description = "This gem is a
|
7
|
+
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
8
8
|
s.authors = ["Elastic"]
|
9
9
|
s.email = 'info@elastic.co'
|
10
10
|
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
|
-
s.add_runtime_dependency "logstash-core-plugin-api", "~>
|
23
|
+
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
24
24
|
s.add_runtime_dependency "stud", '>= 0.0.22'
|
25
25
|
s.add_runtime_dependency 'logstash-codec-plain'
|
26
26
|
s.add_runtime_dependency 'json'
|
metadata
CHANGED
@@ -1,114 +1,116 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-couchdb_changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core-plugin-api
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
19
|
-
name: logstash-core-plugin-api
|
20
|
-
prerelease: false
|
19
|
+
version: '2.0'
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: stud
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 0.0.22
|
33
|
-
name: stud
|
34
|
-
prerelease: false
|
35
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.0.22
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: logstash-codec-plain
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
|
-
name: logstash-codec-plain
|
48
|
-
prerelease: false
|
49
48
|
type: :runtime
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
|
-
name: json
|
62
|
-
prerelease: false
|
63
62
|
type: :runtime
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: ftw
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
73
|
- - "~>"
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: 0.0.42
|
75
|
-
name: ftw
|
76
|
-
prerelease: false
|
77
76
|
type: :development
|
77
|
+
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.0.42
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
+
name: logstash-devutils
|
84
85
|
requirement: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
87
|
- - ">="
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: 0.0.6
|
89
|
-
name: logstash-devutils
|
90
|
-
prerelease: false
|
91
90
|
type: :development
|
91
|
+
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.0.6
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
+
name: logstash-output-elasticsearch
|
98
99
|
requirement: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
101
|
- - ">="
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: '0'
|
103
|
-
name: logstash-output-elasticsearch
|
104
|
-
prerelease: false
|
105
104
|
type: :development
|
105
|
+
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description: This gem is a
|
111
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
112
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
113
|
+
gem is not a stand-alone program
|
112
114
|
email: info@elastic.co
|
113
115
|
executables: []
|
114
116
|
extensions: []
|
@@ -133,7 +135,7 @@ licenses:
|
|
133
135
|
metadata:
|
134
136
|
logstash_plugin: 'true'
|
135
137
|
logstash_group: input
|
136
|
-
post_install_message:
|
138
|
+
post_install_message:
|
137
139
|
rdoc_options: []
|
138
140
|
require_paths:
|
139
141
|
- lib
|
@@ -148,9 +150,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
150
|
- !ruby/object:Gem::Version
|
149
151
|
version: '0'
|
150
152
|
requirements: []
|
151
|
-
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
153
|
-
signing_key:
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.5.1
|
155
|
+
signing_key:
|
154
156
|
specification_version: 4
|
155
157
|
summary: This input captures the _changes stream from a CouchDB instance
|
156
158
|
test_files:
|