- logstash_dir is where we write stuff. not necessarily where our patterns

are installed, so allow pattern_dir.
This commit is contained in:
Pete Fritchman 2009-10-20 04:06:44 +00:00
parent ebbcb3697f
commit 8a332a01e2
3 changed files with 5 additions and 3 deletions

View file

@ -1,6 +1,7 @@
---
mqhost: localhost
logstash_dir: /var/logstash
pattern_dir: /opt/logstash/patterns
log-types:
linux-syslog:

View file

@ -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]

View file

@ -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