module GreenHat::SuperLog

Log Identifier

Public Class Methods

api_json_format?(path) click to toggle source

File Pattern Matching

# File lib/greenhat/thing/super_log.rb, line 33
def self.api_json_format?(path)
  ['rails_api_json_log'].any? { |x| path.include? x }
end
dmesg_format?(path) click to toggle source
# File lib/greenhat/thing/super_log.rb, line 82
def self.dmesg_format?(path)
  %w[
    dmesg
  ].any? { |x| path.include? x }
end
json_format?(path) click to toggle source
# File lib/greenhat/thing/super_log.rb, line 69
def self.json_format?(path)
  %w[
    production_json_log
    gitaly_current
    geo_log
    sidekiq_current
    sidekiq_log
    gitlab_shell_gitlab_shell_log
    gitlab_rails_audit_json_log
    gitlab_rails_application_json_log
  ].any? { |x| path.include? x }
end
log?(kind) click to toggle source
# File lib/greenhat/thing/super_log.rb, line 6
def self.log?(kind)
  [
    'gitaly/current',
    'gitaly/gitaly_ruby_json.log',
    'gitlab-rails/api_json.log',
    'gitlab-rails/application_json.log',
    'gitlab-rails/audit_json.log',
    'gitlab-rails/graphql_json.log',
    'gitlab-rails/integrations_json.log',
    'gitlab-rails/production_json.log',
    'gitlab-rails/sidekiq_client.log',
    'gitlab-shell/gitlab-shell.log',
    'gitlab-workhorse/current',
    'puma/puma_stdout.log',
    'sidekiq/current',
    'gitlab-rails/importer.log',
    'gitlabsos.log',
    'nginx/gitlab_access.log',
    'patroni/current'
  ].any? { |x| x.include? kind.to_s }

  true
end
reconfigure_format?(path) click to toggle source
# File lib/greenhat/thing/super_log.rb, line 43
def self.reconfigure_format?(path)
  %w[
    reconfigure
  ].any? { |x| path.include? x }
end
shellwords?(path) click to toggle source
# File lib/greenhat/thing/super_log.rb, line 49
def self.shellwords?(path)
  %w[
    gitlab_pages_current
    alertmanager_current
    registry_current
    prometheus_current

  ].any? { |x| path.include? x }
end
time_space?(path) click to toggle source
# File lib/greenhat/thing/super_log.rb, line 59
def self.time_space?(path)
  %w[
    postgresql_current
    redis_current
    unicorn_current
    gitlab_monitor_current
    sidekiq_exporter_log
  ].any? { |x| path.include? x }
end
type?(path) click to toggle source

Identify Formatter

# File lib/greenhat/thing/super_log.rb, line 90
def self.type?(path)
  return :api_json_format if api_json_format?(path)
  return :unicorn_stderr_format if unicorn_stderr_format?(path)
  return :reconfigure_format if reconfigure_format?(path)
  return :shellwords if shellwords?(path)
  return :time_space if time_space?(path)
  return :json_format if json_format?(path)
  return :dmesg_format if dmesg_format?(path)

  nil
end
unicorn_stderr_format?(path) click to toggle source
# File lib/greenhat/thing/super_log.rb, line 37
def self.unicorn_stderr_format?(path)
  %w[
    unicorn_stderr
  ].any? { |x| path.include? x }
end