lib/logstash-cli/cli.rb in logstash-cli-0.0.2 vs lib/logstash-cli/cli.rb in logstash-cli-0.0.3

- old
+ new

@@ -1,12 +1,13 @@ require 'rubygems' require 'bundler/setup' require 'rack' +require 'amqp' require 'tire' require 'time' require 'fastercsv' -require 'logstash-cli/command/grep' +require 'logstash-cli/command' module LogstashCli class CLI < Thor include LogstashCli::Command @@ -14,17 +15,41 @@ desc "grep PATTERN", "Search logstash for a pattern" method_option :esurl , :default => 'http://localhost:9200', :desc => "URL to connect to elasticsearch" method_option :index_prefix , :default => "logstash-", :desc => "Logstash index prefix" method_option :from , :default => "#{Time.now.strftime('%Y-%m-%d')}", :desc => "Begin date" method_option :to, :default => "#{Time.now.strftime('%Y-%m-%d')}", :desc => "End date" - method_option :format , :default => 'csv', :desc => "Format to use for exporting" + method_option :format , :default => 'csv', :desc => "Format to use for exporting (plain,csv,json)" method_option :size , :default => 500, :desc => "Number of results to return" method_option :last , :default => nil, :desc => "Specify period since now f.i. 1d" method_option :meta , :default => "type,message", :desc => "Meta Logstash fields to show" - method_option :fields , :default => "message,program", :desc => "Logstash Fields to show" - method_option :delim , :default => "|", :desc => "csv delimiter" + method_option :fields , :default => "", :desc => "Logstash Fields to show" + method_option :delim , :default => "|", :desc => "plain or csv delimiter" + def grep(pattern) _grep(pattern,options) + end + + desc "tail", "Stream a live feed via AMQP" + method_option :url, :desc => "Alternate way to specify settings via an AMQP Url f.i. amqp://logstash:foopass@localhost:5672. \n This takes precendence over other settings. Note that username and password need to be percentage encoded(URL encoded) in case of special characters",:aliases => "\--amqpurl" + method_option :user, :default => 'logstash', :desc => "User to connect to AMQP" + method_option :password, :default => 'foo', :desc => "Password to connect to AMQP" + method_option :vhost, :default => '/', :desc => "VHost to connect to AMQP" + method_option :port, :default => 5672, :desc => "Port to connect to AMQP" + method_option :host, :default => 'localhost' , :desc => "Host to connect to AMQP" + method_option :ssl, :default => false , :desc => "Enable SSL to connect to AMQP", :type => :boolean + + method_option :exchange, :default => 'rawlogs', :desc => "Exchange name" + method_option :exchange_type, :default => 'direct', :desc => "Exchange Type" + method_option :durable, :default => false, :desc => "Durable Exchange or not", :type => :boolean + method_option :auto_delete, :default => false, :desc => "Autodelete Exchange or not" , :type => :boolean + method_option :persistent, :default => false, :desc => "Persistent Exchange or not", :type => :boolean + method_option :key, :default => '#', :desc => "Routing key" + method_option :format , :default => 'csv', :desc => "Format to use for exporting (plain,csv,json)" + method_option :meta, :default => "timestamp,type,message", :desc => "Meta Logstash fields to show" + method_option :delim, :default => "|", :desc => "csv delimiter" + + def tail() + _tail(options) end end end