logstash-input-file 4.1.13 → 4.1.14

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
  SHA256:
3
- metadata.gz: 256f10c0054f1cabe7fde22c6522dc3c1cf92c169b2584e9e05de977891aab09
4
- data.tar.gz: 96ff5670352287242b9ec116ee4b4bd5051e5256f00bcdf1ef0ef8fba3115c0b
3
+ metadata.gz: ab5ec7dc0c6834c28679c38d676abab3e80ffda7df079e038d5fcebaf2a90afb
4
+ data.tar.gz: 4cdc46401d7f16db0f152cfb4da918e35ea0ebc255451526040fdc4e7225705a
5
5
  SHA512:
6
- metadata.gz: ed265f6a90f677a66c6dcd5823d10e043b1be2c9836e1f5001d3ae4485a1f4496bc8ae4d34781ed79cda6778a8362c2e97b34d41161a0ec3248e10ac70b4c77f
7
- data.tar.gz: b776efe42fb2eadf40b39ce5ba031e4686295b19baaeb20b50608ece46143acd8515e49c65028a5ccb0c0e3732011dcff194f535e4fd9c64b4076f5423a711d9
6
+ metadata.gz: 206db97684f6a7a4a45e56235da12e828d280b500c16ed7bab8d7a3d994dc881d28d9912d664cd9d185b338b7dfd13de47fdd02173935974223b8374281501a9
7
+ data.tar.gz: 74fc9bed35c6f9666b04f88ccf1418faa6f3013c540fb9b40c7da59e925d562ba17d3d4bda34d2f510f24304c965c112b480af5c0b42a96a276113b35e7f24eb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.1.14
2
+ - Fixed bug in delete of multiple watched files [#254](https://github.com/logstash-plugins/logstash-input-file/pull/254)
3
+
1
4
  ## 4.1.13
2
5
  - Fixed sinceDB to work spaces filename [#249](https://github.com/logstash-plugins/logstash-input-file/pull/249)
3
6
 
@@ -19,6 +19,7 @@ module FileWatch
19
19
  Array(paths).each do |f|
20
20
  index = @pointers.delete(f)
21
21
  @files.delete_at(index)
22
+ refresh_pointers
22
23
  end
23
24
  @sort_method.call
24
25
  end
Binary file
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-file'
4
- s.version = '4.1.13'
4
+ s.version = '4.1.14'
5
5
  s.licenses = ['Apache-2.0']
6
6
  s.summary = "Streams 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/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -90,7 +90,7 @@ module FileWatch
90
90
  end
91
91
  end
92
92
 
93
- context "when watching a directory with files, exisiting content is skipped" do
93
+ context "when watching a directory with files, existing content is skipped" do
94
94
  let(:suffix) { "C" }
95
95
  let(:actions) do
96
96
  RSpec::Sequencing
@@ -100,11 +100,11 @@ module FileWatch
100
100
  .then_after(0.1, "begin watching") do
101
101
  tailing.watch_this(watch_dir)
102
102
  end
103
- .then_after(0.2, "add content") do
103
+ .then_after(2, "add content") do
104
104
  File.open(file_path, "ab") { |file| file.write("line1\nline2\n") }
105
105
  end
106
106
  .then("wait") do
107
- wait(0.75).for{listener1.lines.size}.to eq(2)
107
+ wait(0.75).for{listener1.lines}.to eq(["line1", "line2"])
108
108
  end
109
109
  .then("quit") do
110
110
  tailing.quit
@@ -4,12 +4,15 @@ require_relative 'spec_helper'
4
4
  module FileWatch
5
5
  describe WatchedFilesCollection do
6
6
  let(:time) { Time.now }
7
+ let(:filepath1){"/var/log/z.log"}
8
+ let(:filepath2){"/var/log/m.log"}
9
+ let(:filepath3){"/var/log/a.log"}
7
10
  let(:stat1) { double("stat1", :size => 98, :modified_at => time - 30, :identifier => nil, :inode => 234567, :inode_struct => InodeStruct.new("234567", 3, 2)) }
8
11
  let(:stat2) { double("stat2", :size => 99, :modified_at => time - 20, :identifier => nil, :inode => 234568, :inode_struct => InodeStruct.new("234568", 3, 2)) }
9
12
  let(:stat3) { double("stat3", :size => 100, :modified_at => time, :identifier => nil, :inode => 234569, :inode_struct => InodeStruct.new("234569", 3, 2)) }
10
- let(:wf1) { WatchedFile.new("/var/log/z.log", stat1, Settings.new) }
11
- let(:wf2) { WatchedFile.new("/var/log/m.log", stat2, Settings.new) }
12
- let(:wf3) { WatchedFile.new("/var/log/a.log", stat3, Settings.new) }
13
+ let(:wf1) { WatchedFile.new(filepath1, stat1, Settings.new) }
14
+ let(:wf2) { WatchedFile.new(filepath2, stat2, Settings.new) }
15
+ let(:wf3) { WatchedFile.new(filepath3, stat3, Settings.new) }
13
16
 
14
17
  context "sort by last_modified in ascending order" do
15
18
  let(:sort_by) { "last_modified" }
@@ -70,5 +73,23 @@ module FileWatch
70
73
  expect(collection.values).to eq([wf1, wf2, wf3])
71
74
  end
72
75
  end
76
+
77
+ context "when delete called" do
78
+ let(:sort_by) { "path" }
79
+ let(:sort_direction) { "desc" }
80
+
81
+ it "is able to delete multiple files at once" do
82
+ collection = described_class.new(Settings.from_options(:file_sort_by => sort_by, :file_sort_direction => sort_direction))
83
+ collection.add(wf1)
84
+ collection.add(wf2)
85
+ collection.add(wf3)
86
+ expect(collection.keys).to eq([filepath1, filepath2, filepath3])
87
+
88
+ collection.delete([filepath2,filepath3])
89
+ expect(collection.keys).to eq([filepath1])
90
+
91
+ end
92
+ end
93
+
73
94
  end
74
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-file
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.13
4
+ version: 4.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-20 00:00:00.000000000 Z
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement