logstash-input-file 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5c737328c9ce9cac009113fb98dc7c3c83afb29
4
- data.tar.gz: 06894d12c757cd21c3897c8fbaea21c21c603d6a
3
+ metadata.gz: 1ff9aeae9099c3ab7bb3cff6584f411a09224b74
4
+ data.tar.gz: bbf914865a3def9835a798db7ccf73681899f4e6
5
5
  SHA512:
6
- metadata.gz: 262054cc486d7396e9ddd91735f37da14e4afe3b537e8e42433b3d2552f1a700ddcc3ccab4eef7345a05cfa20540b3200267a8eb5a18395d45a54e41334af681
7
- data.tar.gz: 853d71f80cbe1013e0e53422e9b904b4e9e94a8461ce45b9eac0105cc23e3d7da05f0a46de6b7db8a0908bae09afb128988b529ddf4dd485546b97801415f61a
6
+ metadata.gz: e8322dea005cfd7337dab2bf78a538bcad1332eb9329e7e340398bf4a9f43f9764a1b36539bac8378e226b5862b297676803746396349981f145385d7423d2c3
7
+ data.tar.gz: 18358e94256c11112acfa3b5132176078ad1ae2ad043fcce5f86950fc8b5d1c72a6cb06128bb44ebc87bad4df0c9b0376eac97b3d30a438aa77785600ea0eb64
@@ -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
 
@@ -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'
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
 
@@ -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
- tmp_file = Tempfile.new('logstash-spec-input-file')
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 => "#{tmp_file.path}"
17
- sincedb_path => "/dev/null"
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(tmp_file, "w") do |fd|
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(tmp_file, "a") do |fd|
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
- tmp_file = Tempfile.new('logstash-spec-input-file')
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 => "#{tmp_file.path}"
71
+ path => "#{tmpfile_path}"
67
72
  start_position => "beginning"
68
- sincedb_path => "/dev/null"
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(tmp_file, "a") do |fd|
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
- tmp_file = Tempfile.new('logstash-spec-input-file')
90
- tmp_sincedb = Tempfile.new('logstash-spec-input-file-sincedb')
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 => "#{tmp_file.path}"
97
- start_position => "beginning"
98
- sincedb_path => "#{tmp_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(tmp_file, "w") do |fd|
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(tmp_file, "a") do |fd|
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
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-19 00:00:00.000000000 Z
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: