From 8a332a01e2796d708f0d095f1bbde6101307e400 Mon Sep 17 00:00:00 2001 From: Pete Fritchman Date: Tue, 20 Oct 2009 04:06:44 +0000 Subject: [PATCH] - logstash_dir is where we write stuff. not necessarily where our patterns are installed, so allow pattern_dir. --- etc/logstashd.yaml | 1 + lib/log.rb | 1 + lib/log/text.rb | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/logstashd.yaml b/etc/logstashd.yaml index dc784a5c5..184673e82 100644 --- a/etc/logstashd.yaml +++ b/etc/logstashd.yaml @@ -1,6 +1,7 @@ --- mqhost: localhost logstash_dir: /var/logstash +pattern_dir: /opt/logstash/patterns log-types: linux-syslog: diff --git a/lib/log.rb b/lib/log.rb index cb9b69b31..e3318f52b 100644 --- a/lib/log.rb +++ b/lib/log.rb @@ -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] diff --git a/lib/log/text.rb b/lib/log/text.rb index 7ad8383c3..231712e10 100644 --- a/lib/log/text.rb +++ b/lib/log/text.rb @@ -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