Sha256: 1b2a01f64aa877a04ba7591f9d3c64a1e139f3534237d1082aa9e28df6999fd3
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
#!/usr/local/bin/ruby require 'rubygems' require 'logworm_utils' require 'optparse' options = { :limit => 200, :loop => false, :frequency => 10, :fields => [], :conditions => [], :start => nil, :end => nil, :debug => false, :fkat => false } option_parser = OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options] <log table>" opts.on("-f [secs]", Integer, "Continuously check for more data, every [secs] seconds.", "Default: #{options[:frequency]}") do |s| options[:loop] = true options[:frequency] = s if s end opts.on("-r limit", Integer, "Specify how many log entries to fetch.", "Default: #{options[:limit]}") do |n| options[:limit] = n end opts.on("-k fields", String, "Specify a comma-separated list of fields to retrieve.") do |k| options[:fields] = k.split(",").map {|f| f.strip} end opts.on("-c condition", String, "Specify a condition to match. May be used multiple times") do |c| options[:conditions] << c.strip end opts.on("-s starttime", String, "Specify the start time for the query") do |c| options[:start] = c.strip end opts.on("-e endtime", String, "Specify the end time for the query") do |c| options[:end] = c.strip end opts.on("--flat", "Do not expand log entries when printing them") do options[:flat] = true end opts.on("-v", "Show debug information") do options[:debug] = true end opts.on( '-h', '--help', 'Display this screen' ) do puts option_parser.help exit(1) end end # Parse, and get the required <table> option_parser.parse! table = ARGV.pop if !table puts option_parser.help exit(1) end table.strip! # and run t = LogwormTail.new(table, options).run
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
logworm_client-0.3.2 | bin/lw-tail |
logworm_client-0.3.1 | bin/lw-tail |
logworm_client-0.3.0 | bin/lw-tail |