mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- Only ever create one search client, and do it on app startup.
This commit is contained in:
parent
b5ff853c4a
commit
18476af99b
2 changed files with 3 additions and 3 deletions
|
@ -14,12 +14,11 @@ class Search < Application
|
|||
params[:limit] = (params[:limit] ? params[:limit].to_i : 20) rescue 20
|
||||
params[:log_type] = (params[:log_type] or "linux-syslog")
|
||||
|
||||
@search = LogStash::Net::Clients::Search.new("/opt/logstash/etc/logstashd.yaml")
|
||||
#@search = LogStash::Net::Clients::Search.new("/opt/logstash/etc/logstashd.yaml")
|
||||
params[:query] = params[:q]
|
||||
|
||||
Timeout.timeout(10) do
|
||||
@hits, @results = @search.search(params)
|
||||
#@search.run
|
||||
@hits, @results = $search.search(params)
|
||||
render
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,4 +24,5 @@ end
|
|||
|
||||
Merb::BootLoader.after_app_loads do
|
||||
# This will get executed after your app's classes have been loaded.
|
||||
$search = LogStash::Net::Clients::Search.new("/opt/logstash/etc/logstashd.yaml")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue