mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Fixing relative path issues left over from flatjar era
Use plugin_path and pattern_path closes 1377
This commit is contained in:
parent
d6b94edc5d
commit
ab9985c26a
6 changed files with 24 additions and 25 deletions
|
@ -45,7 +45,7 @@ class LogStash::Codecs::Netflow < LogStash::Codecs::Base
|
|||
@templates = Vash.new()
|
||||
|
||||
# Path to default Netflow v9 field definitions
|
||||
filename = File.join(File.dirname(__FILE__), "netflow/netflow.yaml")
|
||||
filename = LogStash::Environment.plugin_path("codecs/netflow/netflow.yaml")
|
||||
|
||||
begin
|
||||
@fields = YAML.load_file(filename)
|
||||
|
|
|
@ -31,5 +31,13 @@ module LogStash
|
|||
def vendor_path(path)
|
||||
return ::File.join(LOGSTASH_HOME, "vendor", path)
|
||||
end
|
||||
|
||||
def plugin_path(path)
|
||||
return ::File.join(LOGSTASH_HOME, "lib/logstash", path)
|
||||
end
|
||||
|
||||
def pattern_path(path)
|
||||
return ::File.join(LOGSTASH_HOME, "patterns", path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -216,7 +216,7 @@ class LogStash::Filters::Grok < LogStash::Filters::Base
|
|||
|
||||
# Detect if we are running from a jarfile, pick the right path.
|
||||
@@patterns_path ||= Set.new
|
||||
@@patterns_path += ["#{File.dirname(__FILE__)}/../../../patterns/*"]
|
||||
@@patterns_path += [LogStash::Environment.pattern_path("*")]
|
||||
|
||||
public
|
||||
def initialize(params)
|
||||
|
|
|
@ -102,7 +102,7 @@ class LogStash::Filters::Multiline < LogStash::Filters::Base
|
|||
|
||||
# Detect if we are running from a jarfile, pick the right path.
|
||||
@@patterns_path = Set.new
|
||||
@@patterns_path += ["#{File.dirname(__FILE__)}/../../../patterns/*"]
|
||||
@@patterns_path += [LogStash::Environment.pattern_path("*")]
|
||||
|
||||
public
|
||||
def initialize(config = {})
|
||||
|
|
|
@ -269,15 +269,9 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|||
public
|
||||
def get_template
|
||||
if @template.nil?
|
||||
if File.exists?("elasticsearch-template.json")
|
||||
@template = "elasticsearch-template.json"
|
||||
else
|
||||
path = File.join(File.dirname(__FILE__), "elasticsearch/elasticsearch-template.json")
|
||||
if File.exists?(path)
|
||||
@template = path
|
||||
else
|
||||
raise "You must specify 'template => ...' in your elasticsearch_http output"
|
||||
end
|
||||
@template = LogStash::Environment.plugin_path("outputs/elasticsearch/elasticsearch-template.json")
|
||||
if !File.exists?(@template)
|
||||
raise "You must specify 'template => ...' in your elasticsearch output (I looked for '#{@template}')"
|
||||
end
|
||||
end
|
||||
template_json = IO.read(@template).gsub(/\n/,'')
|
||||
|
|
|
@ -173,17 +173,14 @@ class LogStash::Outputs::ElasticSearchHTTP < LogStash::Outputs::Base
|
|||
public
|
||||
def get_template_json
|
||||
if @template.nil?
|
||||
if File.exists?("elasticsearch-template.json")
|
||||
@template = "elasticsearch-template.json"
|
||||
elsif File.exists?("lib/logstash/outputs/elasticsearch/elasticsearch-template.json")
|
||||
@template = "lib/logstash/outputs/elasticsearch/elasticsearch-template.json"
|
||||
else
|
||||
raise "You must specify 'template => ...' in your elasticsearch_http output"
|
||||
@template = LogStash::Environment.plugin_path("outputs/elasticsearch/elasticsearch-template.json")
|
||||
if !File.exists?(@template)
|
||||
raise "You must specify 'template => ...' in your elasticsearch_http output (I looked for '#{@template}')"
|
||||
end
|
||||
end
|
||||
@template_json = IO.read(@template).gsub(/\n/,'')
|
||||
@logger.info("Using mapping template", :template => @template_json)
|
||||
end # def get_template
|
||||
end # def get_template_json
|
||||
|
||||
public
|
||||
def receive(event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue