logstash-input-file 2.2.5 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +12 -2
- data/lib/logstash/inputs/file.rb +3 -3
- data/logstash-input-file.gemspec +3 -3
- data/spec/inputs/file_spec.rb +32 -33
- metadata +30 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48cd489f4a3acfa558adc96df81f70df1cac3dfa
|
4
|
+
data.tar.gz: 1565a08c4319d90e7131defaf9e7e8587417dd40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c47a692eed6fb0b76a8934069fc5fc5a9876999be0e65ac5327cdd233a2053ee114d041002444c63fc1a35df6c08db1145336633a4cec509121220ec599f2887
|
7
|
+
data.tar.gz: 2bfd9936dbe9c65e13846d25eb418e0a8b3d1d2060ad64f2e81ebe9bcbfa7b5e843409e6ae04f9a6e14e5045d723143237d97a8df56a72a1c316fc85499dcd1c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
## 3.0.0
|
2
|
+
- Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
|
1
3
|
# 2.2.5
|
2
4
|
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
|
3
5
|
# 2.2.3
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@ Travis Build
|
|
3
3
|
[![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-input-file.svg)](https://travis-ci.org/logstash-plugins/logstash-input-file)
|
4
4
|
|
5
5
|
Jenkins Build
|
6
|
-
[![Build Status](
|
6
|
+
[![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-input-file.svg)](https://travis-ci.org/logstash-plugins/logstash-input-file)
|
7
7
|
|
8
8
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
9
9
|
|
@@ -58,7 +58,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
|
58
58
|
```
|
59
59
|
- Install plugin
|
60
60
|
```sh
|
61
|
+
# Logstash 2.3 and higher
|
62
|
+
bin/logstash-plugin install --no-verify
|
63
|
+
|
64
|
+
# Prior to Logstash 2.3
|
61
65
|
bin/plugin install --no-verify
|
66
|
+
|
62
67
|
```
|
63
68
|
- Run Logstash with your plugin
|
64
69
|
```sh
|
@@ -76,7 +81,12 @@ gem build logstash-filter-awesome.gemspec
|
|
76
81
|
```
|
77
82
|
- Install the plugin from the Logstash home
|
78
83
|
```sh
|
79
|
-
|
84
|
+
# Logstash 2.3 and higher
|
85
|
+
bin/logstash-plugin install --no-verify
|
86
|
+
|
87
|
+
# Prior to Logstash 2.3
|
88
|
+
bin/plugin install --no-verify
|
89
|
+
|
80
90
|
```
|
81
91
|
- Start Logstash and proceed to test the plugin
|
82
92
|
|
data/lib/logstash/inputs/file.rb
CHANGED
@@ -251,8 +251,8 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
251
251
|
end
|
252
252
|
|
253
253
|
def process_event(event)
|
254
|
-
event
|
255
|
-
event
|
254
|
+
event.set("[@metadata][path]", path)
|
255
|
+
event.set("path", path) if !event.include?("path")
|
256
256
|
input.post_process_this(event)
|
257
257
|
end
|
258
258
|
|
@@ -296,7 +296,7 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
296
296
|
end # def run
|
297
297
|
|
298
298
|
def post_process_this(event)
|
299
|
-
event
|
299
|
+
event.set("host", @host) if !event.include?("host")
|
300
300
|
decorate(event)
|
301
301
|
@queue << event
|
302
302
|
end
|
data/logstash-input-file.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-file'
|
4
|
-
s.version = '
|
4
|
+
s.version = '3.0.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Stream events from files."
|
7
|
-
s.description = "This gem is a
|
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"
|
8
8
|
s.authors = ["Elastic"]
|
9
9
|
s.email = 'info@elastic.co'
|
10
10
|
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
@@ -20,7 +20,7 @@ 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-plugin-api", "~>
|
23
|
+
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'logstash-codec-plain'
|
26
26
|
s.add_runtime_dependency 'addressable'
|
data/spec/inputs/file_spec.rb
CHANGED
@@ -45,8 +45,8 @@ describe LogStash::Inputs::File do
|
|
45
45
|
2.times.collect { queue.pop }
|
46
46
|
end
|
47
47
|
|
48
|
-
insist { events[0]
|
49
|
-
insist { events[1]
|
48
|
+
insist { events[0].get("message") } == "hello"
|
49
|
+
insist { events[1].get("message") } == "world"
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should restarts at the sincedb value" do
|
@@ -74,8 +74,8 @@ describe LogStash::Inputs::File do
|
|
74
74
|
2.times.collect { queue.pop }
|
75
75
|
end
|
76
76
|
|
77
|
-
insist { events[0]
|
78
|
-
insist { events[1]
|
77
|
+
insist { events[0].get("message") } == "hello3"
|
78
|
+
insist { events[1].get("message") } == "world3"
|
79
79
|
|
80
80
|
File.open(tmpfile_path, "a") do |fd|
|
81
81
|
fd.puts("foo")
|
@@ -88,9 +88,9 @@ describe LogStash::Inputs::File do
|
|
88
88
|
3.times.collect { queue.pop }
|
89
89
|
end
|
90
90
|
|
91
|
-
insist { events[0]
|
92
|
-
insist { events[1]
|
93
|
-
insist { events[2]
|
91
|
+
insist { events[0].get("message") } == "foo"
|
92
|
+
insist { events[1].get("message") } == "bar"
|
93
|
+
insist { events[2].get("message") } == "baz"
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should not overwrite existing path and host fields" do
|
@@ -120,11 +120,11 @@ describe LogStash::Inputs::File do
|
|
120
120
|
2.times.collect { queue.pop }
|
121
121
|
end
|
122
122
|
|
123
|
-
insist { events[0]
|
124
|
-
insist { events[0]
|
123
|
+
insist { events[0].get("path") } == "my_path"
|
124
|
+
insist { events[0].get("host") } == "my_host"
|
125
125
|
|
126
|
-
insist { events[1]
|
127
|
-
insist { events[1]
|
126
|
+
insist { events[1].get("path") } == "#{tmpfile_path}"
|
127
|
+
insist { events[1].get("host") } == "#{Socket.gethostname.force_encoding(Encoding::UTF_8)}"
|
128
128
|
end
|
129
129
|
|
130
130
|
context "when sincedb_path is an existing directory" do
|
@@ -189,15 +189,15 @@ describe LogStash::Inputs::File do
|
|
189
189
|
|
190
190
|
event1 = events[0]
|
191
191
|
expect(event1).not_to be_nil
|
192
|
-
expect(event1
|
193
|
-
expect(event1[
|
194
|
-
expect(event1
|
192
|
+
expect(event1.get("path")).to eq tmpfile_path
|
193
|
+
expect(event1.get("[@metadata][path]")).to eq tmpfile_path
|
194
|
+
expect(event1.get("message")).to eq "hello"
|
195
195
|
|
196
196
|
event2 = events[1]
|
197
197
|
expect(event2).not_to be_nil
|
198
|
-
expect(event2
|
199
|
-
expect(event2[
|
200
|
-
expect(event2
|
198
|
+
expect(event2.get("path")).to eq tmpfile_path
|
199
|
+
expect(event2.get("[@metadata][path]")).to eq tmpfile_path
|
200
|
+
expect(event2.get("message")).to eq "world"
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
@@ -312,18 +312,18 @@ describe LogStash::Inputs::File do
|
|
312
312
|
.then_after(0.2 , "stop flushes both events") do
|
313
313
|
expect(events.size).to eq(2)
|
314
314
|
e1, e2 = events
|
315
|
-
e1_message = e1
|
316
|
-
e2_message = e2
|
315
|
+
e1_message = e1.get("message")
|
316
|
+
e2_message = e2.get("message")
|
317
317
|
|
318
318
|
# can't assume File A will be read first
|
319
319
|
if e1_message.start_with?('line1.1-of-z')
|
320
|
-
expect(e1
|
321
|
-
expect(e2
|
320
|
+
expect(e1.get("path")).to match(/z.log/)
|
321
|
+
expect(e2.get("path")).to match(/A.log/)
|
322
322
|
expect(e1_message).to eq("line1.1-of-z#{FILE_DELIMITER} line1.2-of-z#{FILE_DELIMITER} line1.3-of-z")
|
323
323
|
expect(e2_message).to eq("line1.1-of-a#{FILE_DELIMITER} line1.2-of-a#{FILE_DELIMITER} line1.3-of-a")
|
324
324
|
else
|
325
|
-
expect(e1
|
326
|
-
expect(e2
|
325
|
+
expect(e1.get("path")).to match(/A.log/)
|
326
|
+
expect(e2.get("path")).to match(/z.log/)
|
327
327
|
expect(e1_message).to eq("line1.1-of-a#{FILE_DELIMITER} line1.2-of-a#{FILE_DELIMITER} line1.3-of-a")
|
328
328
|
expect(e2_message).to eq("line1.1-of-z#{FILE_DELIMITER} line1.2-of-z#{FILE_DELIMITER} line1.3-of-z")
|
329
329
|
end
|
@@ -347,7 +347,7 @@ describe LogStash::Inputs::File do
|
|
347
347
|
end
|
348
348
|
.then_after(0.75, "wait for auto_flush") do
|
349
349
|
e1 = events.first
|
350
|
-
e1_message = e1
|
350
|
+
e1_message = e1.get("message")
|
351
351
|
expect(e1["path"]).to match(/a.log/)
|
352
352
|
expect(e1_message).to eq("line1.1-of-a#{FILE_DELIMITER} line1.2-of-a#{FILE_DELIMITER} line1.3-of-a")
|
353
353
|
end
|
@@ -443,11 +443,11 @@ describe LogStash::Inputs::File do
|
|
443
443
|
e1, e2 = events
|
444
444
|
if Dir.glob("#{tmpdir_path}/*.log").first =~ %r{a\.log}
|
445
445
|
#linux and OSX have different retrieval order
|
446
|
-
expect(e1
|
447
|
-
expect(e2
|
446
|
+
expect(e1.get("message")).to eq("line1-of-a")
|
447
|
+
expect(e2.get("message")).to eq("line2-of-a")
|
448
448
|
else
|
449
|
-
expect(e1
|
450
|
-
expect(e2
|
449
|
+
expect(e1.get("message")).to eq("line1-of-z")
|
450
|
+
expect(e2.get("message")).to eq("line2-of-z")
|
451
451
|
end
|
452
452
|
end
|
453
453
|
subject.run(events)
|
@@ -484,10 +484,10 @@ describe LogStash::Inputs::File do
|
|
484
484
|
else
|
485
485
|
e3, e4, e1, e2 = events
|
486
486
|
end
|
487
|
-
expect(e1
|
488
|
-
expect(e2
|
489
|
-
expect(e3
|
490
|
-
expect(e4
|
487
|
+
expect(e1.get("message")).to eq("line1-of-a")
|
488
|
+
expect(e2.get("message")).to eq("line2-of-a")
|
489
|
+
expect(e3.get("message")).to eq("line1-of-z")
|
490
|
+
expect(e4.get("message")).to eq("line2-of-z")
|
491
491
|
end
|
492
492
|
.then_after(0.1, "stop") do
|
493
493
|
subject.stop
|
@@ -497,7 +497,6 @@ describe LogStash::Inputs::File do
|
|
497
497
|
actions.value
|
498
498
|
end
|
499
499
|
end
|
500
|
-
|
501
500
|
end
|
502
501
|
end
|
503
502
|
end
|
metadata
CHANGED
@@ -1,58 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core-plugin-api
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
19
|
-
name: logstash-core-plugin-api
|
20
|
-
prerelease: false
|
19
|
+
version: '2.0'
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: logstash-codec-plain
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
|
-
name: logstash-codec-plain
|
34
|
-
prerelease: false
|
35
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: addressable
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
|
-
name: addressable
|
48
|
-
prerelease: false
|
49
48
|
type: :runtime
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: filewatch
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
@@ -61,9 +62,8 @@ dependencies:
|
|
61
62
|
- - "~>"
|
62
63
|
- !ruby/object:Gem::Version
|
63
64
|
version: '0.8'
|
64
|
-
name: filewatch
|
65
|
-
prerelease: false
|
66
65
|
type: :runtime
|
66
|
+
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
@@ -73,76 +73,78 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0.8'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
+
name: logstash-codec-multiline
|
76
77
|
requirement: !ruby/object:Gem::Requirement
|
77
78
|
requirements:
|
78
79
|
- - "~>"
|
79
80
|
- !ruby/object:Gem::Version
|
80
81
|
version: 2.0.7
|
81
|
-
name: logstash-codec-multiline
|
82
|
-
prerelease: false
|
83
82
|
type: :runtime
|
83
|
+
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 2.0.7
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
+
name: stud
|
90
91
|
requirement: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
93
|
- - "~>"
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: 0.0.19
|
95
|
-
name: stud
|
96
|
-
prerelease: false
|
97
96
|
type: :development
|
97
|
+
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 0.0.19
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
+
name: logstash-devutils
|
104
105
|
requirement: !ruby/object:Gem::Requirement
|
105
106
|
requirements:
|
106
107
|
- - "~>"
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: 0.0.18
|
109
|
-
name: logstash-devutils
|
110
|
-
prerelease: false
|
111
110
|
type: :development
|
111
|
+
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: 0.0.18
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
+
name: logstash-codec-json
|
118
119
|
requirement: !ruby/object:Gem::Requirement
|
119
120
|
requirements:
|
120
121
|
- - ">="
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
|
-
name: logstash-codec-json
|
124
|
-
prerelease: false
|
125
124
|
type: :development
|
125
|
+
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
+
name: rspec-sequencing
|
132
133
|
requirement: !ruby/object:Gem::Requirement
|
133
134
|
requirements:
|
134
135
|
- - ">="
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: '0'
|
137
|
-
name: rspec-sequencing
|
138
|
-
prerelease: false
|
139
138
|
type: :development
|
139
|
+
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
-
description: This gem is a
|
145
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
146
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
147
|
+
gem is not a stand-alone program
|
146
148
|
email: info@elastic.co
|
147
149
|
executables: []
|
148
150
|
extensions: []
|
@@ -164,7 +166,7 @@ licenses:
|
|
164
166
|
metadata:
|
165
167
|
logstash_plugin: 'true'
|
166
168
|
logstash_group: input
|
167
|
-
post_install_message:
|
169
|
+
post_install_message:
|
168
170
|
rdoc_options: []
|
169
171
|
require_paths:
|
170
172
|
- lib
|
@@ -179,9 +181,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
181
|
- !ruby/object:Gem::Version
|
180
182
|
version: '0'
|
181
183
|
requirements: []
|
182
|
-
rubyforge_project:
|
183
|
-
rubygems_version: 2.
|
184
|
-
signing_key:
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 2.5.1
|
186
|
+
signing_key:
|
185
187
|
specification_version: 4
|
186
188
|
summary: Stream events from files.
|
187
189
|
test_files:
|