mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- search.rb use new LogStash::StopWatch class
This commit is contained in:
parent
646a0948ed
commit
b9a273885f
1 changed files with 3 additions and 3 deletions
|
@ -3,6 +3,7 @@
|
|||
require "rubygems"
|
||||
require "lib/net/clients/search"
|
||||
require "lib/config/base"
|
||||
require "lib/util"
|
||||
require "set"
|
||||
|
||||
Thread::abort_on_exception = true
|
||||
|
@ -11,6 +12,7 @@ def main(args)
|
|||
if ARGV.length != 3
|
||||
$stderr.puts "Usage: search configfile log_type query"
|
||||
end
|
||||
stopwatch = LogStash::StopWatch.new
|
||||
client = LogStash::Net::Clients::Search.new(args[0])
|
||||
hits, results = client.search({
|
||||
:log_type => args[1],
|
||||
|
@ -18,10 +20,8 @@ def main(args)
|
|||
:limit => 100,
|
||||
})
|
||||
|
||||
# Wait for the client to decide it's done.
|
||||
#client.run
|
||||
|
||||
# Collate & print results.
|
||||
puts "Duration: #{stopwatch.to_s(3)}"
|
||||
puts "Hits: #{hits}"
|
||||
puts ""
|
||||
puts results.sort_by { |r| r[0] }.collect { |r| r[1] }.join("\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue