logstash-input-file 1.0.2 → 2.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 +0 -4
- data/Gemfile +1 -3
- data/lib/logstash/inputs/file.rb +5 -12
- data/logstash-input-file.gemspec +5 -5
- data/spec/inputs/file_spec.rb +10 -50
- metadata +13 -21
- data/.gitignore +0 -4
- data/Rakefile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d89bec9a19e18572d601c3b575da6a64b510c96
|
4
|
+
data.tar.gz: eea01181084e3bfbae9fa715ab614e464c13bd64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f47663e174c96a356f8674d7677c3b07a478a1eb9200135aef4bac7d3885a53218254f07a71208d1d96e94704d79ad6a3e6ad4a36f917668526be7d03e584413
|
7
|
+
data.tar.gz: ef3a21a9cc3e66ebdee1b48912fe63b2d5283aec4f090f78acc103df9e2e667b050ccbe08c0484b31713cdc8166ada8321fd38256c697be8f97008c9d88f6653
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
## 1.0.2
|
2
|
-
- Using filewatch >= 0.6.7, tail.quit closes files. Only one set of file
|
3
|
-
handles are used if run is called more than once.
|
4
|
-
|
5
1
|
## 1.0.1
|
6
2
|
- Force dependency on filewatch >= 0.6.5 that fixes a sincedb bug
|
7
3
|
- Better documentation and error handling regarding the "sincedb_path" parameter
|
data/Gemfile
CHANGED
data/lib/logstash/inputs/file.rb
CHANGED
@@ -183,15 +183,12 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
183
183
|
end
|
184
184
|
end # def register
|
185
185
|
|
186
|
-
|
187
|
-
|
186
|
+
public
|
187
|
+
def run(queue)
|
188
188
|
@tail = FileWatch::Tail.new(@tail_config)
|
189
189
|
@tail.logger = @logger
|
190
190
|
@path.each { |path| @tail.tail(path) }
|
191
|
-
end
|
192
191
|
|
193
|
-
def run(queue)
|
194
|
-
begin_tailing
|
195
192
|
@tail.subscribe do |path, line|
|
196
193
|
@logger.debug? && @logger.debug("Received line", :path => path, :text => line)
|
197
194
|
@codec.decode(line) do |event|
|
@@ -202,14 +199,10 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
202
199
|
queue << event
|
203
200
|
end
|
204
201
|
end
|
205
|
-
finished
|
206
202
|
end # def run
|
207
203
|
|
208
204
|
public
|
209
|
-
def
|
210
|
-
|
211
|
-
|
212
|
-
# beforehand
|
213
|
-
@tail.quit if @tail
|
214
|
-
end # def teardown
|
205
|
+
def stop
|
206
|
+
@tail.quit if @tail # _sincedb_write is called implicitly
|
207
|
+
end
|
215
208
|
end # class LogStash::Inputs::File
|
data/logstash-input-file.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-file'
|
4
|
-
s.version = '
|
4
|
+
s.version = '2.0.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Stream events from files."
|
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"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files =
|
14
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
15
15
|
|
16
16
|
# Tests
|
17
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
@@ -20,14 +20,14 @@ 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",
|
23
|
+
s.add_runtime_dependency "logstash-core", "~> 2.0.0.snapshot"
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'logstash-codec-plain'
|
26
26
|
s.add_runtime_dependency 'addressable'
|
27
|
-
s.add_runtime_dependency 'filewatch', ['>= 0.6.
|
27
|
+
s.add_runtime_dependency 'filewatch', ['>= 0.6.5', '~> 0.6']
|
28
28
|
|
29
29
|
s.add_development_dependency 'stud', ['~> 0.0.19']
|
30
|
-
s.add_development_dependency 'logstash-devutils'
|
30
|
+
s.add_development_dependency 'logstash-devutils'
|
31
31
|
s.add_development_dependency 'logstash-codec-json'
|
32
32
|
end
|
33
33
|
|
data/spec/inputs/file_spec.rb
CHANGED
@@ -5,18 +5,19 @@ require "tempfile"
|
|
5
5
|
require "stud/temporary"
|
6
6
|
require "logstash/inputs/file"
|
7
7
|
|
8
|
-
describe
|
9
|
-
before(:all) do
|
10
|
-
@abort_on_exception = Thread.abort_on_exception
|
11
|
-
Thread.abort_on_exception = true
|
12
|
-
end
|
13
|
-
|
14
|
-
after(:all) do
|
15
|
-
Thread.abort_on_exception = @abort_on_exception
|
16
|
-
end
|
8
|
+
describe LogStash::Inputs::File do
|
17
9
|
|
18
10
|
delimiter = (LogStash::Environment.windows? ? "\r\n" : "\n")
|
19
11
|
|
12
|
+
it_behaves_like "an interruptible input plugin" do
|
13
|
+
let(:config) do
|
14
|
+
{
|
15
|
+
"path" => Stud::Temporary.pathname,
|
16
|
+
"sincedb_path" => Stud::Temporary.pathname
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
20
21
|
it "should starts at the end of an existing file" do
|
21
22
|
tmpfile_path = Stud::Temporary.pathname
|
22
23
|
sincedb_path = Stud::Temporary.pathname
|
@@ -188,45 +189,4 @@ describe "inputs/file" do
|
|
188
189
|
expect { subject.register }.to raise_error(ArgumentError)
|
189
190
|
end
|
190
191
|
end
|
191
|
-
|
192
|
-
context "when #run is called multiple times", :unix => true do
|
193
|
-
let(:tmpdir_path) { Stud::Temporary.directory }
|
194
|
-
let(:sincedb_path) { Stud::Temporary.pathname }
|
195
|
-
let(:file_path) { "#{tmpdir_path}/a.log" }
|
196
|
-
let(:buffer) { [] }
|
197
|
-
let(:lsof) { [] }
|
198
|
-
let(:stop_proc) do
|
199
|
-
lambda do |input, arr|
|
200
|
-
Thread.new(input, arr) do |i, a|
|
201
|
-
sleep 0.5
|
202
|
-
a << `lsof -p #{Process.pid} | grep "a.log"`
|
203
|
-
i.teardown
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
subject { LogStash::Inputs::File.new("path" => tmpdir_path + "/*.log", "start_position" => "beginning", "sincedb_path" => sincedb_path) }
|
209
|
-
|
210
|
-
after :each do
|
211
|
-
FileUtils.rm_rf(tmpdir_path)
|
212
|
-
FileUtils.rm_rf(sincedb_path)
|
213
|
-
end
|
214
|
-
before do
|
215
|
-
File.open(file_path, "w") do |fd|
|
216
|
-
fd.puts('foo')
|
217
|
-
fd.puts('bar')
|
218
|
-
end
|
219
|
-
end
|
220
|
-
it "should only have one set of files open" do
|
221
|
-
subject.register
|
222
|
-
lsof_before = `lsof -p #{Process.pid} | grep #{file_path}`
|
223
|
-
expect(lsof_before).to eq("")
|
224
|
-
stop_proc.call(subject, lsof)
|
225
|
-
subject.run(buffer)
|
226
|
-
expect(lsof.first).not_to eq("")
|
227
|
-
stop_proc.call(subject, lsof)
|
228
|
-
subject.run(buffer)
|
229
|
-
expect(lsof.last).to eq(lsof.first)
|
230
|
-
end
|
231
|
-
end
|
232
192
|
end
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- -
|
17
|
-
- !ruby/object:Gem::Version
|
18
|
-
version: 1.4.0
|
19
|
-
- - <
|
16
|
+
- - ~>
|
20
17
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.0.
|
18
|
+
version: 2.0.0.snapshot
|
22
19
|
name: logstash-core
|
23
20
|
prerelease: false
|
24
21
|
type: :runtime
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.4.0
|
30
|
-
- - <
|
24
|
+
- - ~>
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.0.0.
|
26
|
+
version: 2.0.0.snapshot
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
@@ -63,7 +57,7 @@ dependencies:
|
|
63
57
|
requirements:
|
64
58
|
- - '>='
|
65
59
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.6.
|
60
|
+
version: 0.6.5
|
67
61
|
- - ~>
|
68
62
|
- !ruby/object:Gem::Version
|
69
63
|
version: '0.6'
|
@@ -74,7 +68,7 @@ dependencies:
|
|
74
68
|
requirements:
|
75
69
|
- - '>='
|
76
70
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.6.
|
71
|
+
version: 0.6.5
|
78
72
|
- - ~>
|
79
73
|
- !ruby/object:Gem::Version
|
80
74
|
version: '0.6'
|
@@ -95,17 +89,17 @@ dependencies:
|
|
95
89
|
- !ruby/object:Gem::Dependency
|
96
90
|
requirement: !ruby/object:Gem::Requirement
|
97
91
|
requirements:
|
98
|
-
- - '
|
92
|
+
- - '>='
|
99
93
|
- !ruby/object:Gem::Version
|
100
|
-
version: 0
|
94
|
+
version: '0'
|
101
95
|
name: logstash-devutils
|
102
96
|
prerelease: false
|
103
97
|
type: :development
|
104
98
|
version_requirements: !ruby/object:Gem::Requirement
|
105
99
|
requirements:
|
106
|
-
- - '
|
100
|
+
- - '>='
|
107
101
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0
|
102
|
+
version: '0'
|
109
103
|
- !ruby/object:Gem::Dependency
|
110
104
|
requirement: !ruby/object:Gem::Requirement
|
111
105
|
requirements:
|
@@ -126,14 +120,12 @@ executables: []
|
|
126
120
|
extensions: []
|
127
121
|
extra_rdoc_files: []
|
128
122
|
files:
|
129
|
-
- .gitignore
|
130
123
|
- CHANGELOG.md
|
131
124
|
- CONTRIBUTORS
|
132
125
|
- Gemfile
|
133
126
|
- LICENSE
|
134
127
|
- NOTICE.TXT
|
135
128
|
- README.md
|
136
|
-
- Rakefile
|
137
129
|
- lib/logstash/inputs/file.rb
|
138
130
|
- logstash-input-file.gemspec
|
139
131
|
- spec/inputs/file_spec.rb
|
@@ -159,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
151
|
version: '0'
|
160
152
|
requirements: []
|
161
153
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.4.
|
154
|
+
rubygems_version: 2.4.8
|
163
155
|
signing_key:
|
164
156
|
specification_version: 4
|
165
157
|
summary: Stream events from files.
|
data/.gitignore
DELETED