logstash-input-file 0.1.6 → 0.1.7

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: 500b3f380c635a24f90fb21353d1c84bd4576185
4
- data.tar.gz: b0d2d72dbdfec41017aacf5841c8894af02ce62c
3
+ metadata.gz: 3031f11a86bcbaedf755db41a40cf9dd9dbf92b4
4
+ data.tar.gz: d259988e1d462a8a106f7b112196cbf2f1170f52
5
5
  SHA512:
6
- metadata.gz: ba1fae63082f89706dfa6d41d03bba866bcc5056e6777639c9bf7065c4da75298a6b8f1e5be0e4f32d434f0d54b5b31b7facccc9693e1b81d6d55ead19eb6925
7
- data.tar.gz: 35260093ddae69b83a85d4ec2d26511d209b8f5cd589f3208751135f6fcc64d9b44c914c1e00c18483000056528601c8b4396a3236234e956f16f8ee2fe2349c
6
+ metadata.gz: 36871634fa0359b6620cc25fa6da48ee201a3173ce147125345ab5767f5c1c36f2377ec2c9fe24cb5afb2e5e1e708606ed8316b9bfdf95963a52988b17fe0ba5
7
+ data.tar.gz: e5b62dfce3382efcd59c978def84f1ab5310ebebe5d376ce15348f0cabb2a6a4e2517152029b5f206fd718a45f032ae206c53bf8906829890e1b1f35f7f7dfde
@@ -147,7 +147,10 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
147
147
 
148
148
  public
149
149
  def teardown
150
- @tail.sincedb_write
151
- @tail.quit
150
+ if @tail
151
+ @tail.sincedb_write
152
+ @tail.quit
153
+ @tail = nil
154
+ end
152
155
  end # def teardown
153
156
  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 = '0.1.6'
4
+ s.version = '0.1.7'
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"
@@ -8,11 +8,11 @@ describe "inputs/file" do
8
8
 
9
9
  delimiter = (LogStash::Environment.windows? ? "\r\n" : "\n")
10
10
 
11
- describe "starts at the end of an existing file" do
11
+ it "should starts at the end of an existing file" do
12
12
  tmpfile_path = Stud::Temporary.pathname
13
13
  sincedb_path = Stud::Temporary.pathname
14
14
 
15
- config <<-CONFIG
15
+ conf = <<-CONFIG
16
16
  input {
17
17
  file {
18
18
  type => "blah"
@@ -23,25 +23,23 @@ describe "inputs/file" do
23
23
  }
24
24
  CONFIG
25
25
 
26
- input do |pipeline, queue|
27
- File.open(tmpfile_path, "w") do |fd|
28
- fd.puts("ignore me 1")
29
- fd.puts("ignore me 2")
30
- end
26
+ File.open(tmpfile_path, "w") do |fd|
27
+ fd.puts("ignore me 1")
28
+ fd.puts("ignore me 2")
29
+ end
31
30
 
32
- Thread.new { pipeline.run }
33
- sleep 0.1 while !pipeline.ready?
31
+ events = input(conf) do |pipeline, queue|
34
32
 
35
- # at this point even if pipeline.ready? == true the plugins
33
+ # at this point the plugins
36
34
  # threads might still be initializing so we cannot know when the
37
35
  # file plugin will have seen the original file, it could see it
38
36
  # after the first(s) hello world appends below, hence the
39
37
  # retry logic.
40
38
 
41
- retries = 0
42
- loop do
43
- insist { retries } < 20 # 2 secs should be plenty?
39
+ events = []
44
40
 
41
+ retries = 0
42
+ while retries < 20
45
43
  File.open(tmpfile_path, "a") do |fd|
46
44
  fd.puts("hello")
47
45
  fd.puts("world")
@@ -49,22 +47,25 @@ describe "inputs/file" do
49
47
 
50
48
  if queue.size >= 2
51
49
  events = 2.times.collect { queue.pop }
52
- insist { events[0]["message"] } == "hello"
53
- insist { events[1]["message"] } == "world"
54
50
  break
55
51
  end
56
52
 
57
53
  sleep(0.1)
58
54
  retries += 1
59
55
  end
56
+
57
+ events
60
58
  end
59
+
60
+ insist { events[0]["message"] } == "hello"
61
+ insist { events[1]["message"] } == "world"
61
62
  end
62
63
 
63
- describe "can start at the beginning of an existing file" do
64
+ it "should start at the beginning of an existing file" do
64
65
  tmpfile_path = Stud::Temporary.pathname
65
66
  sincedb_path = Stud::Temporary.pathname
66
67
 
67
- config <<-CONFIG
68
+ conf = <<-CONFIG
68
69
  input {
69
70
  file {
70
71
  type => "blah"
@@ -76,64 +77,59 @@ describe "inputs/file" do
76
77
  }
77
78
  CONFIG
78
79
 
79
- input do |pipeline, queue|
80
- File.open(tmpfile_path, "a") do |fd|
81
- fd.puts("hello")
82
- fd.puts("world")
83
- end
84
-
85
- Thread.new { pipeline.run }
86
- sleep 0.1 while !pipeline.ready?
80
+ File.open(tmpfile_path, "a") do |fd|
81
+ fd.puts("hello")
82
+ fd.puts("world")
83
+ end
87
84
 
88
- events = 2.times.collect { queue.pop }
89
- insist { events[0]["message"] } == "hello"
90
- insist { events[1]["message"] } == "world"
85
+ events = input(conf) do |pipeline, queue|
86
+ 2.times.collect { queue.pop }
91
87
  end
88
+
89
+ insist { events[0]["message"] } == "hello"
90
+ insist { events[1]["message"] } == "world"
92
91
  end
93
92
 
94
- describe "restarts at the sincedb value" do
93
+ it "should restarts at the sincedb value" do
95
94
  tmpfile_path = Stud::Temporary.pathname
96
95
  sincedb_path = Stud::Temporary.pathname
97
96
 
98
- config <<-CONFIG
97
+ conf = <<-CONFIG
99
98
  input {
100
99
  file {
101
100
  type => "blah"
102
101
  path => "#{tmpfile_path}"
103
- start_position => "beginning"
102
+ start_position => "beginning"
104
103
  sincedb_path => "#{sincedb_path}"
105
104
  delimiter => "#{delimiter}"
106
105
  }
107
106
  }
108
107
  CONFIG
109
108
 
110
- input do |pipeline, queue|
111
- File.open(tmpfile_path, "w") do |fd|
112
- fd.puts("hello")
113
- fd.puts("world")
114
- end
115
-
116
- t = Thread.new { pipeline.run }
117
- sleep 0.1 while !pipeline.ready?
118
-
119
- events = 2.times.collect { queue.pop }
120
- pipeline.shutdown
121
- t.join
109
+ File.open(tmpfile_path, "w") do |fd|
110
+ fd.puts("hello3")
111
+ fd.puts("world3")
112
+ end
122
113
 
123
- File.open(tmpfile_path, "a") do |fd|
124
- fd.puts("foo")
125
- fd.puts("bar")
126
- fd.puts("baz")
127
- end
114
+ events = input(conf) do |pipeline, queue|
115
+ 2.times.collect { queue.pop }
116
+ end
128
117
 
129
- Thread.new { pipeline.run }
130
- sleep 0.1 while !pipeline.ready?
118
+ insist { events[0]["message"] } == "hello3"
119
+ insist { events[1]["message"] } == "world3"
131
120
 
132
- events = 3.times.collect { queue.pop }
121
+ File.open(tmpfile_path, "a") do |fd|
122
+ fd.puts("foo")
123
+ fd.puts("bar")
124
+ fd.puts("baz")
125
+ end
133
126
 
134
- insist { events[0]["message"] } == "foo"
135
- insist { events[1]["message"] } == "bar"
136
- insist { events[2]["message"] } == "baz"
127
+ events = input(conf) do |pipeline, queue|
128
+ 3.times.collect { queue.pop }
137
129
  end
130
+
131
+ insist { events[0]["message"] } == "foo"
132
+ insist { events[1]["message"] } == "bar"
133
+ insist { events[2]["message"] } == "baz"
138
134
  end
139
135
  end
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-file
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elasticsearch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- requirement: !ruby/object:Gem::Requirement
14
+ name: logstash-core
15
+ version_requirements: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - '>='
17
18
  - !ruby/object:Gem::Version
@@ -19,10 +20,7 @@ dependencies:
19
20
  - - <
20
21
  - !ruby/object:Gem::Version
21
22
  version: 2.0.0
22
- name: logstash-core
23
- prerelease: false
24
- type: :runtime
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - '>='
28
26
  - !ruby/object:Gem::Version
@@ -30,76 +28,78 @@ dependencies:
30
28
  - - <
31
29
  - !ruby/object:Gem::Version
32
30
  version: 2.0.0
31
+ prerelease: false
32
+ type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
+ name: logstash-codec-plain
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
34
40
  requirement: !ruby/object:Gem::Requirement
35
41
  requirements:
36
42
  - - '>='
37
43
  - !ruby/object:Gem::Version
38
44
  version: '0'
39
- name: logstash-codec-plain
40
45
  prerelease: false
41
46
  type: :runtime
47
+ - !ruby/object:Gem::Dependency
48
+ name: addressable
42
49
  version_requirements: !ruby/object:Gem::Requirement
43
50
  requirements:
44
51
  - - '>='
45
52
  - !ruby/object:Gem::Version
46
53
  version: '0'
47
- - !ruby/object:Gem::Dependency
48
54
  requirement: !ruby/object:Gem::Requirement
49
55
  requirements:
50
56
  - - '>='
51
57
  - !ruby/object:Gem::Version
52
58
  version: '0'
53
- name: addressable
54
59
  prerelease: false
55
60
  type: :runtime
61
+ - !ruby/object:Gem::Dependency
62
+ name: filewatch
56
63
  version_requirements: !ruby/object:Gem::Requirement
57
64
  requirements:
58
- - - '>='
65
+ - - '='
59
66
  - !ruby/object:Gem::Version
60
- version: '0'
61
- - !ruby/object:Gem::Dependency
67
+ version: 0.6.1
62
68
  requirement: !ruby/object:Gem::Requirement
63
69
  requirements:
64
70
  - - '='
65
71
  - !ruby/object:Gem::Version
66
72
  version: 0.6.1
67
- name: filewatch
68
73
  prerelease: false
69
74
  type: :runtime
75
+ - !ruby/object:Gem::Dependency
76
+ name: stud
70
77
  version_requirements: !ruby/object:Gem::Requirement
71
78
  requirements:
72
- - - '='
79
+ - - ~>
73
80
  - !ruby/object:Gem::Version
74
- version: 0.6.1
75
- - !ruby/object:Gem::Dependency
81
+ version: 0.0.19
76
82
  requirement: !ruby/object:Gem::Requirement
77
83
  requirements:
78
84
  - - ~>
79
85
  - !ruby/object:Gem::Version
80
86
  version: 0.0.19
81
- name: stud
82
87
  prerelease: false
83
88
  type: :development
89
+ - !ruby/object:Gem::Dependency
90
+ name: logstash-devutils
84
91
  version_requirements: !ruby/object:Gem::Requirement
85
92
  requirements:
86
- - - ~>
93
+ - - '>='
87
94
  - !ruby/object:Gem::Version
88
- version: 0.0.19
89
- - !ruby/object:Gem::Dependency
95
+ version: '0'
90
96
  requirement: !ruby/object:Gem::Requirement
91
97
  requirements:
92
98
  - - '>='
93
99
  - !ruby/object:Gem::Version
94
100
  version: '0'
95
- name: logstash-devutils
96
101
  prerelease: false
97
102
  type: :development
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - '>='
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
103
  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
104
104
  email: info@elasticsearch.com
105
105
  executables: []
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.4.5
140
+ rubygems_version: 2.1.9
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Stream events from files.