module QmailLog

Constants

VERSION

Public Class Methods

analyze(path, host = 'localhost', ssh_options = {}) click to toggle source
# File lib/qmail_log.rb, line 17
def analyze path, host = 'localhost', ssh_options = {}
  QmailLog::SSH::Configure.backend(host, ssh_options)
  @runner = Specinfra::Runner

  raise Errno::ENOENT unless @runner.check_file_is_file(path) or @runner.check_file_is_directory(path)

  data, qid_from_did, memory = [], {}, {}

  files(path).each do |file|
    @runner.get_file_content(file).stdout.split("\n").each do |log|
      QmailLog::Analyzer.analyze(log, data, qid_from_did, memory)
    end
  end
  data
end
files(path) click to toggle source
# File lib/qmail_log.rb, line 37
def files path
  @runner.run_command("find #{path} -type f -exec ls -rt '{}' +").stdout.split("\n")
end
parse(data, format = :json) click to toggle source
# File lib/qmail_log.rb, line 33
def parse data, format = :json
  QmailLog::Formatter.run(format, data)
end