logstash-output-file 2.2.5 → 3.0.0
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 +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.md +12 -3
- data/lib/logstash/outputs/file.rb +2 -2
- data/logstash-output-file.gemspec +3 -3
- data/spec/outputs/file_spec.rb +22 -21
- metadata +22 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 718248e031f059ad44be35fd67bb9b3fa85225cf
|
4
|
+
data.tar.gz: fddc513cf871aa596be1f2139606027edf8cedc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55c52415f8a59a976e1d43853fca4d9bbf98d0c820f41c87b45dbfc65284ea744d0d1c2358767f2ee338b3ea2fc1da9ceb630e0f982e26bc76ccc7fc8255d60f
|
7
|
+
data.tar.gz: d22c09f2d103e421e6e1f67bc890e95f3f2f131fb57b3c7591ef56544f01ccb3c5bc0124a4182daa081b487e3d6f7602520895b23469705c1e0daeb44f8e2186
|
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.4
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
[](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Outputs/job/logstash-plugin-output-file-unit/)
|
3
|
+
[](https://travis-ci.org/logstash-plugins/logstash-output-file)
|
5
4
|
|
6
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
7
6
|
|
@@ -56,7 +55,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
|
56
55
|
```
|
57
56
|
- Install plugin
|
58
57
|
```sh
|
58
|
+
# Logstash 2.3 and higher
|
59
|
+
bin/logstash-plugin install --no-verify
|
60
|
+
|
61
|
+
# Prior to Logstash 2.3
|
59
62
|
bin/plugin install --no-verify
|
63
|
+
|
60
64
|
```
|
61
65
|
- Run Logstash with your plugin
|
62
66
|
```sh
|
@@ -74,7 +78,12 @@ gem build logstash-filter-awesome.gemspec
|
|
74
78
|
```
|
75
79
|
- Install the plugin from the Logstash home
|
76
80
|
```sh
|
77
|
-
|
81
|
+
# Logstash 2.3 and higher
|
82
|
+
bin/logstash-plugin install --no-verify
|
83
|
+
|
84
|
+
# Prior to Logstash 2.3
|
85
|
+
bin/plugin install --no-verify
|
86
|
+
|
78
87
|
```
|
79
88
|
- Start Logstash and proceed to test the plugin
|
80
89
|
|
@@ -54,8 +54,8 @@ class LogStash::Outputs::File < LogStash::Outputs::Base
|
|
54
54
|
# into this file and inside the defined path.
|
55
55
|
config :filename_failure, :validate => :string, :default => '_filepath_failures'
|
56
56
|
|
57
|
-
# If the
|
58
|
-
#
|
57
|
+
# If the configured file is deleted, but an event is handled by the plugin,
|
58
|
+
# the plugin will recreate the file. Default => true
|
59
59
|
config :create_if_deleted, :validate => :boolean, :default => true
|
60
60
|
|
61
61
|
# Dir access mode to use. Note that due to the bug in jruby system umask
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-file'
|
4
|
-
s.version = '
|
4
|
+
s.version = '3.0.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This output will write events to files on disk"
|
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" => "output" }
|
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
|
s.add_runtime_dependency 'logstash-codec-json_lines'
|
25
25
|
s.add_runtime_dependency 'logstash-codec-line'
|
26
26
|
|
data/spec/outputs/file_spec.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require "logstash/devutils/rspec/spec_helper"
|
3
3
|
require "logstash/outputs/file"
|
4
|
+
require "logstash/codecs/line"
|
4
5
|
require "logstash/event"
|
5
6
|
require "logstash/json"
|
6
7
|
require "stud/temporary"
|
@@ -33,10 +34,10 @@ describe LogStash::Outputs::File do
|
|
33
34
|
|
34
35
|
# Now check all events for order and correctness.
|
35
36
|
events = tmp_file.map {|line| LogStash::Event.new(LogStash::Json.load(line))}
|
36
|
-
sorted = events.sort_by {|e| e
|
37
|
+
sorted = events.sort_by {|e| e.get('sequence')}
|
37
38
|
sorted.each do |event|
|
38
|
-
insist {event
|
39
|
-
insist {event
|
39
|
+
insist {event.get("message")} == "hello world"
|
40
|
+
insist {event.get("sequence")} == line_num
|
40
41
|
line_num += 1
|
41
42
|
end
|
42
43
|
|
@@ -68,10 +69,10 @@ describe LogStash::Outputs::File do
|
|
68
69
|
line_num = 0
|
69
70
|
# Now check all events for order and correctness.
|
70
71
|
events = Zlib::GzipReader.open(tmp_file.path).map {|line| LogStash::Event.new(LogStash::Json.load(line)) }
|
71
|
-
sorted = events.sort_by {|e| e
|
72
|
+
sorted = events.sort_by {|e| e.get("sequence")}
|
72
73
|
sorted.each do |event|
|
73
|
-
insist {event
|
74
|
-
insist {event
|
74
|
+
insist {event.get("message")} == "hello world"
|
75
|
+
insist {event.get("sequence")} == line_num
|
75
76
|
line_num += 1
|
76
77
|
end
|
77
78
|
insist {line_num} == event_count
|
@@ -165,7 +166,7 @@ describe LogStash::Outputs::File do
|
|
165
166
|
context "when trying to write outside the files root directory" do
|
166
167
|
let(:bad_event) do
|
167
168
|
event = LogStash::Event.new
|
168
|
-
event
|
169
|
+
event.set('error', '../uncool/directory')
|
169
170
|
event
|
170
171
|
end
|
171
172
|
|
@@ -178,7 +179,7 @@ describe LogStash::Outputs::File do
|
|
178
179
|
|
179
180
|
# Trying to write outside the file root
|
180
181
|
outside_path = "#{'../' * path.split(File::SEPARATOR).size}notcool"
|
181
|
-
bad_event
|
182
|
+
bad_event.set("error", outside_path)
|
182
183
|
|
183
184
|
|
184
185
|
output = LogStash::Outputs::File.new(config)
|
@@ -200,10 +201,10 @@ describe LogStash::Outputs::File do
|
|
200
201
|
output = LogStash::Outputs::File.new({ "path" => "/#{path}/%{error}"})
|
201
202
|
output.register
|
202
203
|
|
203
|
-
bad_event
|
204
|
+
bad_event.set('error', encoded_once)
|
204
205
|
output.receive(bad_event)
|
205
206
|
|
206
|
-
bad_event
|
207
|
+
bad_event.set('error', encoded_twice)
|
207
208
|
output.receive(bad_event)
|
208
209
|
|
209
210
|
expect(Dir.glob(File.join(path, "*")).size).to eq(2)
|
@@ -216,7 +217,7 @@ describe LogStash::Outputs::File do
|
|
216
217
|
output = LogStash::Outputs::File.new({ "path" => "/#{path}/%{error}"})
|
217
218
|
output.register
|
218
219
|
|
219
|
-
bad_event
|
220
|
+
bad_event.set('error', '../..//test')
|
220
221
|
output.receive(bad_event)
|
221
222
|
|
222
223
|
expect(Dir.glob(File.join(path, "*")).size).to eq(1)
|
@@ -228,7 +229,7 @@ describe LogStash::Outputs::File do
|
|
228
229
|
context 'when trying to write inside the file root directory' do
|
229
230
|
it 'write the event to the generated filename' do
|
230
231
|
good_event = LogStash::Event.new
|
231
|
-
good_event
|
232
|
+
good_event.set('error', '42.txt')
|
232
233
|
|
233
234
|
Stud::Temporary.directory do |path|
|
234
235
|
config = { "path" => "#{path}/%{error}" }
|
@@ -236,7 +237,7 @@ describe LogStash::Outputs::File do
|
|
236
237
|
output.register
|
237
238
|
output.receive(good_event)
|
238
239
|
|
239
|
-
good_file = File.join(path, good_event
|
240
|
+
good_file = File.join(path, good_event.get('error'))
|
240
241
|
expect(File.exist?(good_file)).to eq(true)
|
241
242
|
output.close
|
242
243
|
end
|
@@ -284,7 +285,7 @@ describe LogStash::Outputs::File do
|
|
284
285
|
|
285
286
|
it 'write the event to the generated filename with multiple deep' do
|
286
287
|
good_event = LogStash::Event.new
|
287
|
-
good_event
|
288
|
+
good_event.set('error', '/inside/errors/42.txt')
|
288
289
|
|
289
290
|
Stud::Temporary.directory do |path|
|
290
291
|
config = { "path" => "#{path}/%{error}" }
|
@@ -292,7 +293,7 @@ describe LogStash::Outputs::File do
|
|
292
293
|
output.register
|
293
294
|
output.receive(good_event)
|
294
295
|
|
295
|
-
good_file = File.join(path, good_event
|
296
|
+
good_file = File.join(path, good_event.get('error'))
|
296
297
|
expect(File.exist?(good_file)).to eq(true)
|
297
298
|
output.close
|
298
299
|
end
|
@@ -303,7 +304,7 @@ describe LogStash::Outputs::File do
|
|
303
304
|
context "when using default configuration" do
|
304
305
|
it 'write the event as a json line' do
|
305
306
|
good_event = LogStash::Event.new
|
306
|
-
good_event
|
307
|
+
good_event.set('message', 'hello world')
|
307
308
|
|
308
309
|
Stud::Temporary.directory do |path|
|
309
310
|
config = { "path" => "#{path}/output.txt" }
|
@@ -315,7 +316,7 @@ describe LogStash::Outputs::File do
|
|
315
316
|
output.close #teardown first to allow reading the file
|
316
317
|
File.open(good_file) {|f|
|
317
318
|
event = LogStash::Event.new(LogStash::Json.load(f.readline))
|
318
|
-
expect(event
|
319
|
+
expect(event.get("message")).to eq("hello world")
|
319
320
|
}
|
320
321
|
end
|
321
322
|
end
|
@@ -323,7 +324,7 @@ describe LogStash::Outputs::File do
|
|
323
324
|
context "when using line codec" do
|
324
325
|
it 'writes event using specified format' do
|
325
326
|
good_event = LogStash::Event.new
|
326
|
-
good_event
|
327
|
+
good_event.set('message', "hello world")
|
327
328
|
|
328
329
|
Stud::Temporary.directory do |path|
|
329
330
|
config = { "path" => "#{path}/output.txt" }
|
@@ -344,7 +345,7 @@ describe LogStash::Outputs::File do
|
|
344
345
|
context "when using deprecated message_format config" do
|
345
346
|
it 'falls back to line codec' do
|
346
347
|
good_event = LogStash::Event.new
|
347
|
-
good_event
|
348
|
+
good_event.set('message', 'hello world')
|
348
349
|
|
349
350
|
Stud::Temporary.directory do |path|
|
350
351
|
config = { "path" => "#{path}/output.txt", "message_format" => "Custom format: %{message}" }
|
@@ -364,7 +365,7 @@ describe LogStash::Outputs::File do
|
|
364
365
|
context "when using file and dir modes" do
|
365
366
|
it 'dirs and files are created with correct atypical permissions' do
|
366
367
|
good_event = LogStash::Event.new
|
367
|
-
good_event
|
368
|
+
good_event.set('message', "hello world")
|
368
369
|
|
369
370
|
Stud::Temporary.directory do |path|
|
370
371
|
config = {
|
@@ -385,7 +386,7 @@ describe LogStash::Outputs::File do
|
|
385
386
|
output.close #teardown first to allow reading the file
|
386
387
|
File.open(good_file) {|f|
|
387
388
|
event = LogStash::Event.new(LogStash::Json.load(f.readline))
|
388
|
-
expect(event
|
389
|
+
expect(event.get("message")).to eq("hello world")
|
389
390
|
}
|
390
391
|
end
|
391
392
|
end
|
metadata
CHANGED
@@ -1,86 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-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-json_lines
|
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-json_lines
|
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: logstash-codec-line
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
|
-
name: logstash-codec-line
|
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: logstash-devutils
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
|
-
name: logstash-devutils
|
62
|
-
prerelease: false
|
63
62
|
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: logstash-input-generator
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
73
|
- - ">="
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: '0'
|
75
|
-
name: logstash-input-generator
|
76
|
-
prerelease: false
|
77
76
|
type: :development
|
77
|
+
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description: This gem is a
|
83
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
84
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
85
|
+
gem is not a stand-alone program
|
84
86
|
email: info@elastic.co
|
85
87
|
executables: []
|
86
88
|
extensions: []
|
@@ -101,7 +103,7 @@ licenses:
|
|
101
103
|
metadata:
|
102
104
|
logstash_plugin: 'true'
|
103
105
|
logstash_group: output
|
104
|
-
post_install_message:
|
106
|
+
post_install_message:
|
105
107
|
rdoc_options: []
|
106
108
|
require_paths:
|
107
109
|
- lib
|
@@ -116,9 +118,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
118
|
- !ruby/object:Gem::Version
|
117
119
|
version: '0'
|
118
120
|
requirements: []
|
119
|
-
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
121
|
-
signing_key:
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.5.1
|
123
|
+
signing_key:
|
122
124
|
specification_version: 4
|
123
125
|
summary: This output will write events to files on disk
|
124
126
|
test_files:
|