Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

elasticsearch endpoint now configurable. also cleaned up some stuff

  • Loading branch information...
commit 122ff28c34fd78bea276eea19c5fe5fbc1a89781 1 parent 592b285
@lennartkoopmann lennartkoopmann authored
View
1  .gitignore
@@ -7,6 +7,7 @@ nbproject/*
config/mongoid.yml
config/general.yml
config/email.yml
+config/indexer.yml
Capfile
config/deploy.rb
View
13 app/models/configuration.rb
@@ -1,6 +1,7 @@
class Configuration
@general_config = YAML::load File.read(Rails.root.to_s + "/config/general.yml")
@email_config = YAML::load File.read(Rails.root.to_s + "/config/email.yml")
+ @indexer_config = YAML::load File.read(Rails.root.to_s + "/config/indexer.yml")
def self.config_value(root, nesting, key, default = nil)
[root, root[nesting.to_s], root[nesting.to_s][key.to_s]].any?(&:blank?) ? default : root[nesting.to_s][key.to_s]
@@ -105,6 +106,14 @@ def self.email_config(key = nil, default = nil)
@email_config[Rails.env]
end
end
+
+ def self.indexer_config(key = nil, default = nil)
+ if key
+ config_value @indexer_config, Rails.env, key, default
+ else
+ @indexer_config[Rails.env]
+ end
+ end
def self.email_transport_type
default = :sendmail
@@ -122,4 +131,8 @@ def self.email_smtp_settings
end
end
end
+
+ def self.indexer_host
+ indexer_config :url
+ end
end
View
1  app/models/message.rb
@@ -9,7 +9,6 @@ class Message
attr_accessor :plain, :total_result_count
- # XXX ELASTIC: possibly do this with Tire.configuration.wrapper
def self.parse_from_elastic(x)
m = self.new
View
3  app/models/message_gateway.rb
@@ -14,7 +14,6 @@ class MessageGateway
include Tire::Model::Search
include Mongoid::Document
- # XXX ELASTIC: make configurable. also host etc
INDEX_NAME = "graylog2"
TYPE_NAME = "message"
@@ -58,8 +57,6 @@ def self.all_by_quickfilter(filters, page = 1, opts = {})
# Host
must { term(:host, filters[:host]) } unless filters[:host].blank?
- # XXX ELASTIC hostgroup missing.
-
# Additional fields.
Quickfilter.extract_additional_fields_from_request(filters).each do |key, value|
must { term("_#{key}".to_sym, value) }
View
2  config/indexer.yml.example
@@ -0,0 +1,2 @@
+production:
+ url: http://localhost:9200/
View
3  config/initializers/indexer.rb
@@ -0,0 +1,3 @@
+Tire.configure do
+ url(Configuration.indexer_host)
+end
Please sign in to comment.
Something went wrong with that request. Please try again.