Module: CloudwatchQuery

Defined in:
lib/cloudwatch_query.rb,
lib/cloudwatch_query/query.rb,
lib/cloudwatch_query/client.rb,
lib/cloudwatch_query/errors.rb,
lib/cloudwatch_query/result.rb,
lib/cloudwatch_query/parsers.rb,
lib/cloudwatch_query/version.rb,
lib/cloudwatch_query/result_set.rb,
lib/cloudwatch_query/parsers/base.rb,
lib/cloudwatch_query/time_helpers.rb,
lib/cloudwatch_query/configuration.rb,
lib/cloudwatch_query/parsers/registry.rb,
lib/cloudwatch_query/parsers/rails_parser.rb,
lib/cloudwatch_query/parsers/sidekiq_parser.rb,
lib/cloudwatch_query/parsers/rails/rails_log.rb,
lib/cloudwatch_query/parsers/rails/sub_parsers.rb,
lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb,
lib/cloudwatch_query/parsers/sidekiq/sub_parsers.rb

Defined Under Namespace

Modules: Parsers, TimeHelpers Classes: AuthError, Client, ConfigError, Configuration, Error, Query, QueryError, Result, ResultSet, TimeoutError

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configuration ⇒ Object



15
16
17
# File 'lib/cloudwatch_query.rb', line 15

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



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

def configure
  yield(configuration)
end

.list_log_groups(prefix: nil) ⇒ Object

List available log groups



57
58
59
# File 'lib/cloudwatch_query.rb', line 57

def list_log_groups(prefix: nil)
  Client.new.list_log_groups(prefix: prefix)
end

.logs(*groups) ⇒ Object Also known as: log_group

Start a query for the specified log groups



43
44
45
# File 'lib/cloudwatch_query.rb', line 43

def logs(*groups)
  Query.new.logs(*groups)
end

.parsers ⇒ Object

Parser registry - manages log message parsers



28
29
30
31
32
33
34
# File 'lib/cloudwatch_query.rb', line 28

def parsers
  @parsers ||= begin
    registry = Parsers::Registry.new
    registry.register(*Parsers.default_parsers)
    registry
  end
end

.reset_configuration! ⇒ Object



23
24
25
# File 'lib/cloudwatch_query.rb', line 23

def reset_configuration!
  @configuration = Configuration.new
end

.reset_parsers! ⇒ Object

Reset parsers to defaults



37
38
39
40
# File 'lib/cloudwatch_query.rb', line 37

def reset_parsers!
  @parsers = nil
  parsers
end

.search(term, groups:, since: nil, limit: nil) ⇒ Object

Quick search shorthand



49
50
51
52
53
54
# File 'lib/cloudwatch_query.rb', line 49

def search(term, groups:, since: nil, limit: nil)
  query = Query.new.logs(*Array(groups)).contains(term)
  query = query.since(since) if since
  query = query.limit(limit) if limit
  query.execute
end