mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- logstash_dir is where we write stuff. not necessarily where our patterns
are installed, so allow pattern_dir.
This commit is contained in:
parent
ebbcb3697f
commit
8a332a01e2
3 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
mqhost: localhost
|
mqhost: localhost
|
||||||
logstash_dir: /var/logstash
|
logstash_dir: /var/logstash
|
||||||
|
pattern_dir: /opt/logstash/patterns
|
||||||
|
|
||||||
log-types:
|
log-types:
|
||||||
linux-syslog:
|
linux-syslog:
|
||||||
|
|
|
@ -18,6 +18,7 @@ module LogStash
|
||||||
check_hash_keys(config, REQUIRED_KEYS, OPTIONAL_KEYS)
|
check_hash_keys(config, REQUIRED_KEYS, OPTIONAL_KEYS)
|
||||||
|
|
||||||
@home = config[:logstash_dir] || ENV["LOGSTASH_DIR"] || "/opt/logstash"
|
@home = config[:logstash_dir] || ENV["LOGSTASH_DIR"] || "/opt/logstash"
|
||||||
|
@pattern_dir = config[:pattern_dir] || @home
|
||||||
@attrs = {"log:type" => config[:type],
|
@attrs = {"log:type" => config[:type],
|
||||||
"log:encoding" => config[:encoding]}
|
"log:encoding" => config[:encoding]}
|
||||||
if config[:attrs]
|
if config[:attrs]
|
||||||
|
|
|
@ -25,12 +25,12 @@ module LogStash
|
||||||
|
|
||||||
super(config)
|
super(config)
|
||||||
|
|
||||||
if not File.exists?("#{@home}/patterns")
|
if not File.exists?("#{@pattern_dir}/patterns")
|
||||||
throw StandardError.new("#{@home}/patterns/ does not exist")
|
throw StandardError.new("#{@pattern_dir}/patterns/ does not exist")
|
||||||
end
|
end
|
||||||
|
|
||||||
pattern_files = []
|
pattern_files = []
|
||||||
Find.find("#{@home}/patterns") do |file|
|
Find.find("#{@pattern_dir}/patterns") do |file|
|
||||||
# ignore directories
|
# ignore directories
|
||||||
next if File.directory?(file)
|
next if File.directory?(file)
|
||||||
# ignore dotfiles
|
# ignore dotfiles
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue