Module: OAS::LogCollector

Extended by:
LogCollector
Included in:
LogCollector
Defined in:
lib/oas/log_collector.rb,
lib/oas/log_collector/source.rb,
lib/oas/log_collector/manager.rb,
lib/oas/log_collector/version.rb,
lib/oas/log_collector/log_file.rb

Defined Under Namespace

Classes: LogFile, Manager, Source

Constant Summary collapse

DEFAULTS =
{
  :sources  => [],
  :source_logs_path => "/tmp",
  :logs_path        => "~/oas-log-collector",
  :days_to_search   => 10,
  :files_to_copy    => 90,
  :sleep_seconds    => 900,
  :redis_url        => 'redis://localhost:6379/0'
}
VERSION =
"0.1.6"

Instance Method Summary collapse

Instance Method Details

#optionsObject



19
20
21
# File 'lib/oas/log_collector.rb', line 19

def options
  @options ||= DEFAULTS.dup
end

#redis(&block) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
# File 'lib/oas/log_collector.rb', line 23

def redis(&block)
  @redis ||= ConnectionPool.new(:timeout => 1, :size => options[:sources].size) { Redis.connect(:url => options[:redis_url]) }
  raise ArgumentError, "requires a block" if !block
  @redis.with(&block)
end

#redis=(conn) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/oas/log_collector.rb', line 29

def redis=(conn)
  if conn.is_a?(ConnectionPool)
    @redis = conn
  else
    raise ArgumentError, "redis= requires a ConnectionPool"
  end
end