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
|
||||
logstash_dir: /var/logstash
|
||||
pattern_dir: /opt/logstash/patterns
|
||||
|
||||
log-types:
|
||||
linux-syslog:
|
||||
|
|
|
@ -18,6 +18,7 @@ module LogStash
|
|||
check_hash_keys(config, REQUIRED_KEYS, OPTIONAL_KEYS)
|
||||
|
||||
@home = config[:logstash_dir] || ENV["LOGSTASH_DIR"] || "/opt/logstash"
|
||||
@pattern_dir = config[:pattern_dir] || @home
|
||||
@attrs = {"log:type" => config[:type],
|
||||
"log:encoding" => config[:encoding]}
|
||||
if config[:attrs]
|
||||
|
|
|
@ -25,12 +25,12 @@ module LogStash
|
|||
|
||||
super(config)
|
||||
|
||||
if not File.exists?("#{@home}/patterns")
|
||||
throw StandardError.new("#{@home}/patterns/ does not exist")
|
||||
if not File.exists?("#{@pattern_dir}/patterns")
|
||||
throw StandardError.new("#{@pattern_dir}/patterns/ does not exist")
|
||||
end
|
||||
|
||||
pattern_files = []
|
||||
Find.find("#{@home}/patterns") do |file|
|
||||
Find.find("#{@pattern_dir}/patterns") do |file|
|
||||
# ignore directories
|
||||
next if File.directory?(file)
|
||||
# ignore dotfiles
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue