logstash-input-file 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/inputs/file.rb +4 -0
- data/logstash-input-file.gemspec +2 -1
- data/spec/inputs/file_spec.rb +24 -17
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff9aeae9099c3ab7bb3cff6584f411a09224b74
|
4
|
+
data.tar.gz: bbf914865a3def9835a798db7ccf73681899f4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8322dea005cfd7337dab2bf78a538bcad1332eb9329e7e340398bf4a9f43f9764a1b36539bac8378e226b5862b297676803746396349981f145385d7423d2c3
|
7
|
+
data.tar.gz: 18358e94256c11112acfa3b5132176078ad1ae2ad043fcce5f86950fc8b5d1c72a6cb06128bb44ebc87bad4df0c9b0376eac97b3d30a438aa77785600ea0eb64
|
data/lib/logstash/inputs/file.rb
CHANGED
@@ -65,6 +65,9 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
65
65
|
# has no effect.
|
66
66
|
config :start_position, :validate => [ "beginning", "end"], :default => "end"
|
67
67
|
|
68
|
+
# set the new line delimiter, defaults to "\n"
|
69
|
+
config :delimiter, :validate => :string, :default => "\n"
|
70
|
+
|
68
71
|
public
|
69
72
|
def register
|
70
73
|
require "addressable/uri"
|
@@ -77,6 +80,7 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
77
80
|
:stat_interval => @stat_interval,
|
78
81
|
:discover_interval => @discover_interval,
|
79
82
|
:sincedb_write_interval => @sincedb_write_interval,
|
83
|
+
:delimiter => @delimiter,
|
80
84
|
:logger => @logger,
|
81
85
|
}
|
82
86
|
|
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 = '0.1.
|
4
|
+
s.version = '0.1.5'
|
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"
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency 'addressable'
|
27
27
|
s.add_runtime_dependency 'filewatch', ['0.6.1']
|
28
28
|
|
29
|
+
s.add_development_dependency 'stud', ['~> 0.0.19']
|
29
30
|
s.add_development_dependency 'logstash-devutils'
|
30
31
|
end
|
31
32
|
|
data/spec/inputs/file_spec.rb
CHANGED
@@ -2,25 +2,29 @@
|
|
2
2
|
|
3
3
|
require "logstash/devutils/rspec/spec_helper"
|
4
4
|
require "tempfile"
|
5
|
+
require "stud/temporary"
|
5
6
|
|
6
7
|
describe "inputs/file" do
|
7
|
-
|
8
|
+
|
9
|
+
delimiter = (LogStash::Environment.windows? ? "\r\n" : "\n")
|
8
10
|
|
9
11
|
describe "starts at the end of an existing file" do
|
10
|
-
|
12
|
+
tmpfile_path = Stud::Temporary.pathname
|
13
|
+
sincedb_path = Stud::Temporary.pathname
|
11
14
|
|
12
15
|
config <<-CONFIG
|
13
16
|
input {
|
14
17
|
file {
|
15
18
|
type => "blah"
|
16
|
-
path => "#{
|
17
|
-
sincedb_path => "
|
19
|
+
path => "#{tmpfile_path}"
|
20
|
+
sincedb_path => "#{sincedb_path}"
|
21
|
+
delimiter => "#{delimiter}"
|
18
22
|
}
|
19
23
|
}
|
20
24
|
CONFIG
|
21
25
|
|
22
26
|
input do |pipeline, queue|
|
23
|
-
File.open(
|
27
|
+
File.open(tmpfile_path, "w") do |fd|
|
24
28
|
fd.puts("ignore me 1")
|
25
29
|
fd.puts("ignore me 2")
|
26
30
|
end
|
@@ -38,7 +42,7 @@ describe "inputs/file" do
|
|
38
42
|
loop do
|
39
43
|
insist { retries } < 20 # 2 secs should be plenty?
|
40
44
|
|
41
|
-
File.open(
|
45
|
+
File.open(tmpfile_path, "a") do |fd|
|
42
46
|
fd.puts("hello")
|
43
47
|
fd.puts("world")
|
44
48
|
end
|
@@ -57,21 +61,23 @@ describe "inputs/file" do
|
|
57
61
|
end
|
58
62
|
|
59
63
|
describe "can start at the beginning of an existing file" do
|
60
|
-
|
64
|
+
tmpfile_path = Stud::Temporary.pathname
|
65
|
+
sincedb_path = Stud::Temporary.pathname
|
61
66
|
|
62
67
|
config <<-CONFIG
|
63
68
|
input {
|
64
69
|
file {
|
65
70
|
type => "blah"
|
66
|
-
path => "#{
|
71
|
+
path => "#{tmpfile_path}"
|
67
72
|
start_position => "beginning"
|
68
|
-
sincedb_path => "
|
73
|
+
sincedb_path => "#{sincedb_path}"
|
74
|
+
delimiter => "#{delimiter}"
|
69
75
|
}
|
70
76
|
}
|
71
77
|
CONFIG
|
72
78
|
|
73
79
|
input do |pipeline, queue|
|
74
|
-
File.open(
|
80
|
+
File.open(tmpfile_path, "a") do |fd|
|
75
81
|
fd.puts("hello")
|
76
82
|
fd.puts("world")
|
77
83
|
end
|
@@ -86,22 +92,23 @@ describe "inputs/file" do
|
|
86
92
|
end
|
87
93
|
|
88
94
|
describe "restarts at the sincedb value" do
|
89
|
-
|
90
|
-
|
95
|
+
tmpfile_path = Stud::Temporary.pathname
|
96
|
+
sincedb_path = Stud::Temporary.pathname
|
91
97
|
|
92
98
|
config <<-CONFIG
|
93
99
|
input {
|
94
100
|
file {
|
95
101
|
type => "blah"
|
96
|
-
path => "#{
|
97
|
-
|
98
|
-
sincedb_path => "#{
|
102
|
+
path => "#{tmpfile_path}"
|
103
|
+
start_position => "beginning"
|
104
|
+
sincedb_path => "#{sincedb_path}"
|
105
|
+
delimiter => "#{delimiter}"
|
99
106
|
}
|
100
107
|
}
|
101
108
|
CONFIG
|
102
109
|
|
103
110
|
input do |pipeline, queue|
|
104
|
-
File.open(
|
111
|
+
File.open(tmpfile_path, "w") do |fd|
|
105
112
|
fd.puts("hello")
|
106
113
|
fd.puts("world")
|
107
114
|
end
|
@@ -113,7 +120,7 @@ describe "inputs/file" do
|
|
113
120
|
pipeline.shutdown
|
114
121
|
t.join
|
115
122
|
|
116
|
-
File.open(
|
123
|
+
File.open(tmpfile_path, "a") do |fd|
|
117
124
|
fd.puts("foo")
|
118
125
|
fd.puts("bar")
|
119
126
|
fd.puts("baz")
|
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: 0.1.
|
4
|
+
version: 0.1.5
|
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-
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.6.1
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ~>
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.0.19
|
81
|
+
name: stud
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.0.19
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
requirement: !ruby/object:Gem::Requirement
|
77
91
|
requirements:
|