logstash-input-file 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -0
- data/README.md +1 -1
- data/lib/logstash/inputs/file.rb +5 -4
- data/logstash-input-file.gemspec +3 -2
- data/spec/inputs/file_spec.rb +33 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c00455f8bb65b9d802f81ac12c095d0bc1454136
|
4
|
+
data.tar.gz: dd80537404262d563d574e2062fd429364b466f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 605811dd4d4fda955593aeafaab43f5a6a7da1be23f27b8623d9b7db82a2aa0a4c0a8f87123e0223a62247e9e358fe6984e8e78e4e6199ea78426f53f9e005c7
|
7
|
+
data.tar.gz: eae72cf60f9e4608a27351df34e083714a72cf56ba97fd0aeddc61785bd05652ed12fce58fd61109a2bcfa4308a352ff993db9ce97264ad46c1e466118bcf5e8
|
data/CHANGELOG.md
ADDED
File without changes
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Logstash provides infrastructure to automatically generate documentation for thi
|
|
13
13
|
|
14
14
|
## Need Help?
|
15
15
|
|
16
|
-
Need help? Try #logstash on freenode IRC or the logstash
|
16
|
+
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
17
17
|
|
18
18
|
## Developing
|
19
19
|
|
data/lib/logstash/inputs/file.rb
CHANGED
@@ -25,7 +25,7 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
25
25
|
# Paths must be absolute and cannot be relative.
|
26
26
|
#
|
27
27
|
# You may also configure multiple paths. See an example
|
28
|
-
# on the
|
28
|
+
# on the <<array,Logstash configuration page>>.
|
29
29
|
config :path, :validate => :array, :required => true
|
30
30
|
|
31
31
|
# Exclusions (matched against the filename, not full path). Globs
|
@@ -74,6 +74,7 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
74
74
|
require "filewatch/tail"
|
75
75
|
require "digest/md5"
|
76
76
|
@logger.info("Registering file input", :path => @path)
|
77
|
+
@host = Socket.gethostname.force_encoding(Encoding::UTF_8)
|
77
78
|
|
78
79
|
@tail_config = {
|
79
80
|
:exclude => @exclude,
|
@@ -131,14 +132,14 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
|
|
131
132
|
@tail = FileWatch::Tail.new(@tail_config)
|
132
133
|
@tail.logger = @logger
|
133
134
|
@path.each { |path| @tail.tail(path) }
|
134
|
-
hostname = Socket.gethostname
|
135
135
|
|
136
136
|
@tail.subscribe do |path, line|
|
137
137
|
@logger.debug? && @logger.debug("Received line", :path => path, :text => line)
|
138
138
|
@codec.decode(line) do |event|
|
139
|
+
event["[@metadata][path]"] = path
|
140
|
+
event["host"] = @host if !event.include?("host")
|
141
|
+
event["path"] = path if !event.include?("path")
|
139
142
|
decorate(event)
|
140
|
-
event["host"] = hostname if !event.include?("host")
|
141
|
-
event["path"] = path
|
142
143
|
queue << event
|
143
144
|
end
|
144
145
|
end
|
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.11'
|
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"
|
@@ -24,9 +24,10 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'logstash-codec-plain'
|
26
26
|
s.add_runtime_dependency 'addressable'
|
27
|
-
s.add_runtime_dependency 'filewatch', ['>= 0.6.
|
27
|
+
s.add_runtime_dependency 'filewatch', ['>= 0.6.4', '~> 0.6']
|
28
28
|
|
29
29
|
s.add_development_dependency 'stud', ['~> 0.0.19']
|
30
30
|
s.add_development_dependency 'logstash-devutils'
|
31
|
+
s.add_development_dependency 'logstash-codec-json'
|
31
32
|
end
|
32
33
|
|
data/spec/inputs/file_spec.rb
CHANGED
@@ -132,4 +132,37 @@ describe "inputs/file" do
|
|
132
132
|
insist { events[1]["message"] } == "bar"
|
133
133
|
insist { events[2]["message"] } == "baz"
|
134
134
|
end
|
135
|
+
|
136
|
+
it "should not overwrite existing path and host fields" do
|
137
|
+
tmpfile_path = Stud::Temporary.pathname
|
138
|
+
sincedb_path = Stud::Temporary.pathname
|
139
|
+
|
140
|
+
conf = <<-CONFIG
|
141
|
+
input {
|
142
|
+
file {
|
143
|
+
type => "blah"
|
144
|
+
path => "#{tmpfile_path}"
|
145
|
+
start_position => "beginning"
|
146
|
+
sincedb_path => "#{sincedb_path}"
|
147
|
+
delimiter => "#{delimiter}"
|
148
|
+
codec => "json"
|
149
|
+
}
|
150
|
+
}
|
151
|
+
CONFIG
|
152
|
+
|
153
|
+
File.open(tmpfile_path, "w") do |fd|
|
154
|
+
fd.puts('{"path": "my_path", "host": "my_host"}')
|
155
|
+
fd.puts('{"my_field": "my_val"}')
|
156
|
+
end
|
157
|
+
|
158
|
+
events = input(conf) do |pipeline, queue|
|
159
|
+
2.times.collect { queue.pop }
|
160
|
+
end
|
161
|
+
|
162
|
+
insist { events[0]["path"] } == "my_path"
|
163
|
+
insist { events[0]["host"] } == "my_host"
|
164
|
+
|
165
|
+
insist { events[1]["path"] } == "#{tmpfile_path}"
|
166
|
+
insist { events[1]["host"] } == "#{Socket.gethostname.force_encoding(Encoding::UTF_8)}"
|
167
|
+
end
|
135
168
|
end
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.6.
|
67
|
+
version: 0.6.4
|
68
68
|
- - ~>
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0.6'
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.6.
|
75
|
+
version: 0.6.4
|
76
76
|
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0.6'
|
@@ -106,6 +106,20 @@ dependencies:
|
|
106
106
|
version: '0'
|
107
107
|
prerelease: false
|
108
108
|
type: :development
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: logstash-codec-json
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
prerelease: false
|
122
|
+
type: :development
|
109
123
|
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
|
110
124
|
email: info@elastic.co
|
111
125
|
executables: []
|
@@ -113,6 +127,7 @@ extensions: []
|
|
113
127
|
extra_rdoc_files: []
|
114
128
|
files:
|
115
129
|
- .gitignore
|
130
|
+
- CHANGELOG.md
|
116
131
|
- CONTRIBUTORS
|
117
132
|
- Gemfile
|
118
133
|
- LICENSE
|