Sha256: 304e32a78aab0b844fd2b70b59528caaadd83f198b0e51c7aafc4596b99cce8b

Contents?: true

Size: 854 Bytes

Versions: 158

Compression:

Stored size: 854 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class AuditLogCommand < Kontena::Command
    include Kontena::Cli::Common
    include Common

    option ["-l", "--lines"], "LINES", "Number of lines"

    requires_current_master
    requires_current_master_token
    requires_current_grid

    def execute
      audit_logs = client.get("grids/#{current_grid}/audit_log", {limit: lines})
      puts '%-30.30s %-10s %-15s %-25s %-15s %-25s %-15s %-15s' % ['Time', 'Grid', 'Resource Type', 'Resource Name', 'Event Name', 'User', 'Source IP', 'User-Agent']
      audit_logs['logs'].each do |log|
        puts '%-30.30s %-10s %-15s %-25s %-15s %-25s %-15s %-15s' % [ log['time'], log['grid'], log['resource_type'], log['resource_name'], log['event_name'], log['user_identity']['email'], log['source_ip'], log['user_agent']]
      end
    end
  end
end

Version data entries

158 entries across 158 versions & 2 rubygems

Version Path
kontena-cli-1.2.2.rc1 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.1 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.1.rc1 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0.rc3 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0.rc2 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0.rc1 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0.pre3 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.6 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0.pre1 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.5 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.5.rc1 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.4 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.2.0.dev1 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.3 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.2 lib/kontena/cli/grids/audit_log_command.rb
kontena-cli-1.1.2.rc2 lib/kontena/cli/grids/audit_log_command.rb