Exemple #1
0
    def show_statistics(self):
        """Display statistical information about audit log including:
            - size, date, etc.
            - Audit log entries
        """
        out_format = self.options.get("format", "GRID")
        log_name = self.options.get("log_name", None)
        # Print file statistics:
        print "#\n# Audit Log File Statistics:\n#"
        show_file_statistics(log_name, False, out_format)

        # Print audit log 'AUDIT' entries
        print "\n#\n# Audit Log Startup Entries:\n#\n"
        cols, rows = convert_dictionary_list(self.log.header_rows)
        # Note: No need to sort rows, retrieved with the same order
        # as read (i.e., sorted by timestamp)
        print_list(sys.stdout, out_format, cols, rows)
Exemple #2
0
    def show_statistics(self):
        """Display statistical information about audit log including:
            - size, date, etc.
            - Audit log entries
        """
        out_format = self.options.get("format", "GRID")
        log_name = self.options.get("log_name", None)
        # Print file statistics:
        print "#\n# Audit Log File Statistics:\n#"
        show_file_statistics(log_name, False, out_format)

        # Print audit log 'AUDIT' entries
        print "\n#\n# Audit Log Startup Entries:\n#\n"
        cols, rows = convert_dictionary_list(self.log.header_rows)
        # Note: No need to sort rows, retrieved with the same order
        # as read (i.e., sorted by timestamp)
        print_list(sys.stdout, out_format, cols, rows)
        if log_error:
            parser.error(log_error)

    # Show audit log options before command
    if opt.show_options:
        # if some other command has run
        if len(args):
            print("#\n# Showing options before command.")
        log.show_options()

    # Execute the command specified
    if len(args):
        log.do_command()

    # Show audit log options after command if appropriate
    if opt.show_options and len(args):
        # if some other command has run
        print("#\n# Showing options after command.")
        log.show_options()

    # Do file stats
    if opt.file_stats:
        show_file_statistics(opt.log_name, True)

except UtilError:
    _, e, _ = sys.exc_info()
    print("ERROR: %s" % e.errmsg)
    sys.exit(1)

sys.exit(0)
            if log_error:
                parser.error(log_error)

        # Show audit log options before command
        if opt.show_options:
            # if some other command has run
            if len(args):
                print("#\n# Showing options before command.")
            log.show_options()

        # Execute the command specified
        if len(args):
            log.do_command()

        # Show audit log options after command if appropriate
        if opt.show_options and len(args):
            # if some other command has run
            print("#\n# Showing options after command.")
            log.show_options()

        # Do file stats
        if opt.file_stats:
            show_file_statistics(opt.log_name, True)

    except UtilError:
        _, e, _ = sys.exc_info()
        print("ERROR: %s" % e.errmsg)
        sys.exit(1)

    sys.exit(0)