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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39708420cb297cae2205c5e2ef4e595f2b1652f0
4
- data.tar.gz: 405f93ecc407455518f14fb9d16544e9357733b6
3
+ metadata.gz: 2d89bec9a19e18572d601c3b575da6a64b510c96
4
+ data.tar.gz: eea01181084e3bfbae9fa715ab614e464c13bd64
5
5
  SHA512:
6
- metadata.gz: c2460287157dd990831b5f91717f9004c9eb2af6469d73a15596ab029eb0579941c5a7d10a392e8e857cd02d2c84fe22e5b830d1d44ec7fba8789ba69e86bb32
7
- data.tar.gz: 2fea4c08d6adcd180f920bf33083292d1d06a6bb9b209d67a5f150d4c6f800667ed230484df139f7b0bc0542fe2689b068e6b3f129981bbefcc8dfc312b22438
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
@@ -1,4 +1,2 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem 'concurrent-ruby', '0.9.1'
2
+ gemspec
@@ -183,15 +183,12 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
183
183
  end
184
184
  end # def register
185
185
 
186
- def begin_tailing
187
- teardown # if the pipeline restarts this input.
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 teardown
210
- # in filewatch >= 0.6.7, quit will close and forget all files
211
- # but it will write their last read positions to since_db
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
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-file'
4
- s.version = '1.0.2'
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 = `git ls-files`.split($\)+::Dir.glob('vendor/*')
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", '>= 1.4.0', '< 2.0.0.alpha0'
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.7', '~> 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', '= 0.0.15'
30
+ s.add_development_dependency 'logstash-devutils'
31
31
  s.add_development_dependency 'logstash-codec-json'
32
32
  end
33
33
 
@@ -5,18 +5,19 @@ require "tempfile"
5
5
  require "stud/temporary"
6
6
  require "logstash/inputs/file"
7
7
 
8
- describe "inputs/file" do
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: 1.0.2
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-12-04 00:00:00.000000000 Z
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.alpha0
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.alpha0
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.7
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.7
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.0.15
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.0.15
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.5
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
@@ -1,4 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- .bundle
4
- vendor
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- @files=[]
2
-
3
- task :default do
4
- system("rake -T")
5
- end
6
-
7
- require "logstash/devutils/rake"