示例#1
0
    def __init__(self):
        """Constructor: add description to argparser."""
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=False)

        self.argparser.description = ('Extracts general information from '
                                      'logfile and prints it to stdout.')
        self.argparser.add_argument('--debug',
                                    action='store_true',
                                    help=('show debug output '
                                          '(depends on info section)'))
        self.argparser.add_argument('--verbose',
                                    action='store_true',
                                    help=('show more verbose output '
                                          '(depends on info section)'))

        inf = 'info sections'
        cmds = ('Below commands activate additional info sections for the '
                'log file.')
        self.argparser_sectiongroup = self.argparser.add_argument_group(
            inf, cmds)

        # add all filter classes from the filters module
        self.sections = ([
            c[1](self) for c in inspect.getmembers(sections, inspect.isclass)
        ])
示例#2
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        self.argparser.description='A script to plot various information from logfiles. ' \
            'Clicking on any of the plot points will print the corresponding log line to stdout.'

        # import all plot type classes in plottypes module
        self.plot_types = [c[1] for c in inspect.getmembers(plottypes, inspect.isclass)]
        self.plot_types = dict((pt.plot_type_str, pt) for pt in self.plot_types)
        self.plot_instances = []

        # main parser arguments
        self.argparser.add_argument('--exclude-ns', action='store', nargs='*', metavar='NS', help='(deprecated) use a prior mlogfilter instead.')
        self.argparser.add_argument('--ns', action='store', nargs='*', metavar='NS', help='(deprecated) use a prior mlogfilter instead. ')
        self.argparser.add_argument('--logscale', action='store_true', help='plot y-axis in logarithmic scale (default=off)')
        self.argparser.add_argument('--overlay', action='store', nargs='?', default=None, const='add', choices=['add', 'list', 'reset'], help="create combinations of several plots. Use '--overlay' to create an overlay (this will not plot anything). The first call without '--overlay' will additionally plot all existing overlays. Use '--overlay reset' to clear all overlays.")
        self.argparser.add_argument('--type', action='store', default='scatter', choices=self.plot_types.keys(), help='type of plot (default=scatter with --yaxis duration).')        
        self.argparser.add_argument('--group', help="specify value to group on. Possible values depend on type of plot. All basic plot types can group on 'namespace', 'operation', 'thread', range and histogram plots can additionally group on 'log2code'.")

        # mutex = self.argparser.add_mutually_exclusive_group()
        # mutex.add_argument('--label', help="instead of specifying a group, a label can be specified. Grouping is then disabled, and the single group for all data points is named LABEL.")

        self.legend = None

        # store logfile ranges
        self.logfile_ranges = []
示例#3
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        self.argparser.description='A script to plot various information from logfiles. ' \
            'Clicking on any of the plot points will print the corresponding log line to stdout.'

        # disable some default shortcuts
        plt.rcParams['keymap.xscale'] = ''
        plt.rcParams['keymap.yscale'] = ''

        # import all plot type classes in plottypes module
        self.plot_types = [c[1] for c in inspect.getmembers(plottypes, inspect.isclass)]
        self.plot_types = dict((pt.plot_type_str, pt) for pt in self.plot_types)
        self.plot_instances = []

        # main parser arguments
        self.argparser.add_argument('--logscale', action='store_true', help='plot y-axis in logarithmic scale (default=off)')
        self.argparser.add_argument('--overlay', action='store', nargs='?', default=None, const='add', choices=['add', 'list', 'reset'], help="create combinations of several plots. Use '--overlay' to create an overlay (this will not plot anything). The first call without '--overlay' will additionally plot all existing overlays. Use '--overlay reset' to clear all overlays.")
        self.argparser.add_argument('--type', action='store', default='scatter', choices=self.plot_types.keys(), help='type of plot (default=scatter with --yaxis duration).')        
        self.argparser.add_argument('--title', action='store', default=None, help='change the title of the plot (default=filename(s))')        
        self.argparser.add_argument('--group', help="specify value to group on. Possible values depend on type of plot. All basic plot types can group on 'namespace', 'operation', 'thread', 'pattern', range and histogram plots can additionally group on 'log2code'. The group can also be a regular expression.")
        self.argparser.add_argument('--group-limit', metavar='N', type=int, default=None, help="specify an upper limit of the number of groups. Groups are sorted by number of data points. If limit is specified, only the top N will be listed separately, the rest are grouped together in an 'others' group")
        self.argparser.add_argument('--no-others', action='store_true', default=False, help="if this flag is used, the 'others' group (see --group-limit) will be discarded.")
        self.argparser.add_argument('--optime-start', action='store_true', default=False, help="plot operations with a duration when they started instead (by subtracting the duration). The default is to plot them when they finish (at the time they are logged).")

        self.legend = None

        # progress bar
        self.progress_bar_enabled = not self.is_stdin
示例#4
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        # add all filter classes from the filters module
        self.filters = [
            c[1] for c in inspect.getmembers(filters, inspect.isclass)
        ]

        self.argparser.description = 'mongod/mongos log file parser. Use parameters to enable filters. A line only gets printed if it passes all enabled filters.'
        self.argparser.add_argument(
            '--verbose',
            action='store_true',
            help='outputs information about the parser and arguments.')
        self.argparser.add_argument(
            '--shorten',
            action='store',
            type=int,
            default=False,
            nargs='?',
            metavar='LENGTH',
            help=
            'shortens long lines by cutting characters out of the middle until the length is <= LENGTH (default 200)'
        )
        self.argparser.add_argument(
            '--exclude',
            action='store_true',
            default=False,
            help=
            'if set, excludes the matching lines rather than includes them.')
        self.argparser.add_argument(
            '--human',
            action='store_true',
            help=
            'outputs numbers formatted with commas and milliseconds as hr,min,sec,ms for easier readability.'
        )
示例#5
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        self.argparser.description='A script to plot various information from logfiles. ' \
            'Clicking on any of the plot points will print the corresponding log line to stdout.'

        # disable some default shortcuts
        plt.rcParams['keymap.xscale'] = ''
        plt.rcParams['keymap.yscale'] = ''

        # import all plot type classes in plottypes module
        self.plot_types = [c[1] for c in inspect.getmembers(plottypes, inspect.isclass)]
        self.plot_types = dict((pt.plot_type_str, pt) for pt in self.plot_types)
        self.plot_instances = []
        self.plot_instance = None

        # main parser arguments
        self.argparser.add_argument('--logscale', action='store_true', help='plot y-axis in logarithmic scale (default=off)')
        self.argparser.add_argument('--overlay', action='store', nargs='?', default=None, const='add', choices=['add', 'list', 'reset'], help="create combinations of several plots. Use '--overlay' to create an overlay (this will not plot anything). The first call without '--overlay' will additionally plot all existing overlays. Use '--overlay reset' to clear all overlays.")
        self.argparser.add_argument('--type', action='store', default='scatter', choices=self.plot_types.keys(), help='type of plot (default=scatter with --yaxis duration).')        
        self.argparser.add_argument('--title', action='store', default=None, help='change the title of the plot (default=filename(s))')        
        self.argparser.add_argument('--group', help="specify value to group on. Possible values depend on type of plot. All basic plot types can group on 'namespace', 'operation', 'thread', 'pattern', range and histogram plots can additionally group on 'log2code'. The group can also be a regular expression.")
        self.argparser.add_argument('--group-limit', metavar='N', type=int, default=None, help="specify an upper limit of the number of groups. Groups are sorted by number of data points. If limit is specified, only the top N will be listed separately, the rest are grouped together in an 'others' group")
        self.argparser.add_argument('--no-others', action='store_true', default=False, help="if this flag is used, the 'others' group (see --group-limit) will be discarded.")
        self.argparser.add_argument('--optime-start', action='store_true', default=False, help="plot operations with a duration when they started instead (by subtracting the duration). The default is to plot them when they finish (at the time they are logged).")
        self.argparser.add_argument('--ylimits', action='store', default=None, type=int, nargs=2, metavar='VAL', help="if set, limits the y-axis view to [min, max], requires exactly 2 values.")
        self.argparser.add_argument('--output-file', metavar='FILE', action='store', default=None, help="Save the plot to a file instead of displaying it in a window")

        self.legend = None

        # progress bar
        self.progress_bar_enabled = not self.is_stdin
示例#6
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = ('mongod/mongos log file visualizer '
                                      '(browser edition). Extracts '
                                      'information from each line of the log '
                                      'file and outputs a html file that can '
                                      'be viewed in a browser. Automatically '
                                      'opens a browser tab and shows the '
                                      'file.')
        self.argparser.add_argument('--no-browser',
                                    action='store_true',
                                    help=('only creates .html file, but does '
                                          'not open the browser.'))
        self.argparser.add_argument('--out',
                                    '-o',
                                    action='store',
                                    default=None,
                                    help=('filename to output. Default is '
                                          '<original logfile>.html'))
        self.argparser.add_argument('--line-max',
                                    action='store',
                                    type=int,
                                    default=10000,
                                    help=('max count of datapoints at which '
                                          'actual log line strings are not '
                                          'printed any more.'))
示例#7
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        self.argparser.description='A script to plot various information from logfiles. ' \
            'Clicking on any of the plot points will print the corresponding log line to stdout.'

        # import all plot type classes in plottypes module
        self.plot_types = [
            c[1] for c in inspect.getmembers(plottypes, inspect.isclass)
        ]
        self.plot_types = dict(
            (pt.plot_type_str, pt) for pt in self.plot_types)
        self.plot_instances = []

        # main parser arguments
        self.argparser.add_argument(
            '--exclude-ns',
            action='store',
            nargs='*',
            metavar='NS',
            help='(deprecated) use a prior mlogfilter instead.')
        self.argparser.add_argument(
            '--ns',
            action='store',
            nargs='*',
            metavar='NS',
            help='(deprecated) use a prior mlogfilter instead. ')
        self.argparser.add_argument(
            '--logscale',
            action='store_true',
            help='plot y-axis in logarithmic scale (default=off)')
        self.argparser.add_argument(
            '--overlay',
            action='store',
            nargs='?',
            default=None,
            const='add',
            choices=['add', 'list', 'reset'],
            help=
            "create combinations of several plots. Use '--overlay' to create an overlay (this will not plot anything). The first call without '--overlay' will additionally plot all existing overlays. Use '--overlay reset' to clear all overlays."
        )
        self.argparser.add_argument(
            '--type',
            action='store',
            default='scatter',
            choices=self.plot_types.keys(),
            help='type of plot (default=scatter with --yaxis duration).')
        self.argparser.add_argument(
            '--group',
            help=
            "specify value to group on. Possible values depend on type of plot. All basic plot types can group on 'namespace', 'operation', 'thread', range and histogram plots can additionally group on 'log2code'."
        )

        # mutex = self.argparser.add_mutually_exclusive_group()
        # mutex.add_argument('--label', help="instead of specifying a group, a label can be specified. Grouping is then disabled, and the single group for all data points is named LABEL.")

        self.legend = None

        # store logfile ranges
        self.logfile_ranges = []
示例#8
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'Anonymizes log files by replacing IP addresses, namespaces, strings.'
        self.argparser.add_argument('--seed', '-s', action='store', metavar='S', default=None, help='seed the random number generator with S (any string)')

        self.replacements = {}
示例#9
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'mongod/mongos log file visualizer (browser edition). Extracts \
            information from each line of the log file and outputs a html file that can be viewed in \
            a browser. Automatically opens a browser tab and shows the file.'
        self.argparser.add_argument('--no-browser', action='store_true', help='only creates .html file, but does not open the browser.')
        self.argparser.add_argument('--out', '-o', action='store', default=None, help='filename to output. Default is <original logfile>.html')
示例#10
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        # add all filter classes from the filters module
        self.filters = [c[1] for c in inspect.getmembers(filters, inspect.isclass)]

        self.argparser.description = "mongod/mongos log file parser. Use parameters to enable filters. A line only gets printed if it passes all enabled filters. If several log files are provided, their lines are merged by timestamp."
        self.argparser.add_argument(
            "--verbose", action="store_true", help="outputs information about the parser and arguments."
        )
        self.argparser.add_argument(
            "--shorten",
            action="store",
            type=int,
            default=False,
            nargs="?",
            metavar="LENGTH",
            help="shortens long lines by cutting characters out of the middle until the length is <= LENGTH (default 200)",
        )
        self.argparser.add_argument(
            "--exclude",
            action="store_true",
            default=False,
            help="if set, excludes the matching lines rather than includes them.",
        )
        self.argparser.add_argument(
            "--human",
            action="store_true",
            help="outputs large numbers formatted with commas and print milliseconds as hr,min,sec,ms for easier readability.",
        )
        self.argparser.add_argument(
            "--json",
            action="store_true",
            help="outputs all matching lines in json format rather than the native log line.",
        )
        self.argparser.add_argument(
            "--markers",
            action="store",
            nargs="*",
            default=["filename"],
            help="use markers when merging several files to distinguish them. Choose from none, enum, alpha, filename (default), or provide list.",
        )
        self.argparser.add_argument(
            "--timezone",
            action="store",
            nargs="*",
            default=[],
            type=int,
            metavar="N",
            help="timezone adjustments: add N hours to corresponding log file, single value for global adjustment.",
        )
        self.argparser.add_argument(
            "--timestamp-format",
            action="store",
            default="none",
            choices=["none", "ctime-pre2.4", "ctime", "iso8601-utc", "iso8601-local"],
            help="choose datetime format for log output",
        )
示例#11
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)
        
        self.filters = [] 

        self.argparser.description = 'mongod/mongos log file parser. Use parameters to enable filters. A line only gets printed if it passes all enabled filters.'
        self.argparser.add_argument('--verbose', action='store_true', help='outputs information about the parser and arguments.')
        self.argparser.add_argument('--shorten', action='store', type=int, default=False, nargs='?', metavar='LENGTH', help='shortens long lines by cutting characters out of the middle until the length is <= LENGTH (default 200)')
        self.argparser.add_argument('--exclude', action='store_true', default=False, help='if set, excludes the matching lines rather than includes them.')
示例#12
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)
        
        self.argparser.description = 'Groups all log messages in the logfile together \
            and only displays a distinct set of messages with count'

        self.argparser.add_argument('--verbose', action='store_true', default=False, 
            help="outputs lines that couldn't be matched.")
示例#13
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)
        
        self.argparser.description = 'Groups all log messages in the logfile together \
            and only displays a distinct set of messages with count'

        self.argparser.add_argument('--verbose', action='store_true', default=False, 
            help="outputs lines that couldn't be matched.")
示例#14
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=False)

        self.argparser.description = 'Extracts general information from logfile and prints it to stdout.'
        self.argparser.add_argument('--verbose', action='store_true', help='show more verbose output (depends on info section)')
        self.argparser_sectiongroup = self.argparser.add_argument_group('info sections', 'Below commands activate additional info sections for the log file.')

        # add all filter classes from the filters module
        self.sections = [c[1](self) for c in inspect.getmembers(sections, inspect.isclass)]
示例#15
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)
        
        # add all filter classes from the filters module
        self.filters = [c[1] for c in inspect.getmembers(filters, inspect.isclass)]

        self.argparser.description = 'mongod/mongos log file parser. Use parameters to enable filters. A line only gets printed if it passes all enabled filters.'
        self.argparser.add_argument('--verbose', action='store_true', help='outputs information about the parser and arguments.')
        self.argparser.add_argument('--shorten', action='store', type=int, default=False, nargs='?', metavar='LENGTH', help='shortens long lines by cutting characters out of the middle until the length is <= LENGTH (default 200)')
        self.argparser.add_argument('--exclude', action='store_true', default=False, help='if set, excludes the matching lines rather than includes them.')
        self.argparser.add_argument('--human', action='store_true', help='outputs numbers formatted with commas and milliseconds as hr,min,sec,ms for easier readability.')
示例#16
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        self.argparser.description='A script to plot various information from logfiles. ' \
            'Clicking on any of the plot points will print the corresponding log line to stdout.'

        self.plot_types = [
            DurationPlotType, EventPlotType, RangePlotType, RSStatePlotType
        ]
        self.plot_types = dict(
            (pt.plot_type_str, pt) for pt in self.plot_types)
        self.plot_instances = []

        # main parser arguments
        self.argparser.add_argument('--exclude-ns',
                                    action='store',
                                    nargs='*',
                                    metavar='NS',
                                    help='namespaces to exclude in the plot')
        self.argparser.add_argument(
            '--ns',
            action='store',
            nargs='*',
            metavar='NS',
            help='namespaces to include in the plot (default=all)')
        self.argparser.add_argument(
            '--logscale',
            action='store_true',
            help='plot y-axis in logarithmic scale (default=off)')
        self.argparser.add_argument('--overlay',
                                    action='store',
                                    nargs='?',
                                    default=None,
                                    const='add',
                                    choices=['add', 'list', 'reset'])
        self.argparser.add_argument('--type',
                                    action='store',
                                    default='duration',
                                    choices=self.plot_types.keys(),
                                    help='type of plot (default=duration)')

        mutex = self.argparser.add_mutually_exclusive_group()
        mutex.add_argument(
            '--group',
            help=
            "specify value to group on. Possible values depend on type of plot. All basic plot types can group on 'namespace', 'operation', 'thread', range plots can additionally group on 'log2code'."
        )
        mutex.add_argument(
            '--label',
            help=
            "instead of specifying a group, a label can be specified. Grouping is then disabled, and the single group for all data points is named LABEL."
        )

        self.legend = None
示例#17
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self,
                             multiple_logfiles=False,
                             stdin_allowed=False)

        self.argparser.description = 'Extracts general information from logfile and prints it to stdout.'
        self.argparser.add_argument(
            '--restarts',
            action='store_true',
            help='outputs information about every detected restart.')
示例#18
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        # add all filter classes from the filters module
        self.filters = [c[1] for c in inspect.getmembers(filters, inspect.isclass)]

        self.argparser.description = 'mongod/mongos log file parser. Use parameters to enable filters. A line only gets printed if it passes all enabled filters. If several log files are provided, their lines are merged by timestamp.'
        self.argparser.add_argument('--verbose', action='store_true', help='outputs information about the parser and arguments.')
        self.argparser.add_argument('--shorten', action='store', type=int, default=False, nargs='?', metavar='LENGTH', help='shortens long lines by cutting characters out of the middle until the length is <= LENGTH (default 200)')
        self.argparser.add_argument('--exclude', action='store_true', default=False, help='if set, excludes the matching lines rather than includes them.')
        self.argparser.add_argument('--human', action='store_true', help='outputs large numbers formatted with commas and print milliseconds as hr,min,sec,ms for easier readability.')
        self.argparser.add_argument('--json', action='store_true', help='outputs all matching lines in json format rather than the native log line.')
        self.argparser.add_argument('--markers', action='store', nargs='*', default=['filename'], help='use markers when merging several files to distinguish them. Choose from none, enum, alpha, filename (default), or provide list.')
        self.argparser.add_argument('--timezone', action='store', nargs='*', default=[], type=int, metavar="N", help="timezone adjustments: add N hours to corresponding log file, single value for global adjustment.")
        self.argparser.add_argument('--timestamp-format', action='store', default='none', choices=['none', 'ctime-pre2.4', 'ctime', 'iso8601-utc', 'iso8601-local'], help="choose datetime format for log output")
示例#19
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'mongod/mongos log file visualizer (browser edition). Extracts \
            information from each line of the log file and outputs a html file that can be viewed in \
            a browser. Automatically opens a browser tab and shows the file.'

        self.argparser.add_argument(
            '--no-browser',
            action='store_true',
            help='only creates .html file, but does not open the browser.')
        self.argparser.add_argument(
            '--out',
            '-o',
            action='store',
            default=None,
            help='filename to output. Default is <original logfile>.html')
示例#20
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        self.argparser.description='A script to plot various information from logfiles. ' \
            'Clicking on any of the plot points will print the corresponding log line to stdout.'

        self.plot_types = [DurationPlotType, EventPlotType, RangePlotType, RSStatePlotType]
        self.plot_types = dict((pt.plot_type_str, pt) for pt in self.plot_types)
        self.plot_instances = []

        # main parser arguments
        self.argparser.add_argument('--exclude-ns', action='store', nargs='*', metavar='NS', help='namespaces to exclude in the plot')
        self.argparser.add_argument('--ns', action='store', nargs='*', metavar='NS', help='namespaces to include in the plot (default=all)')
        self.argparser.add_argument('--logscale', action='store_true', help='plot y-axis in logarithmic scale (default=off)')
        self.argparser.add_argument('--overlay', action='store', nargs='?', default=None, const='add', choices=['add', 'list', 'reset'])
        self.argparser.add_argument('--type', action='store', default='duration', choices=self.plot_types.keys(), help='type of plot (default=duration)')
        
        mutex = self.argparser.add_mutually_exclusive_group()
        mutex.add_argument('--group', help="specify value to group on. Possible values depend on type of plot. All basic plot types can group on 'namespace', 'operation', 'thread', range plots can additionally group on 'log2code'.")
        mutex.add_argument('--label', help="instead of specifying a group, a label can be specified. Grouping is then disabled, and the single group for all data points is named LABEL.")

        self.legend = None
示例#21
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = ('mongod/mongos log file visualizer '
                                      '(browser edition). Extracts '
                                      'information from each line of the log '
                                      'file and outputs a html file that can '
                                      'be viewed in a browser. Automatically '
                                      'opens a browser tab and shows the '
                                      'file.')
        self.argparser.add_argument('--no-browser', action='store_true',
                                    help=('only creates .html file, but does '
                                          'not open the browser.'))
        self.argparser.add_argument('--out', '-o', action='store',
                                    default=None,
                                    help=('filename to output. Default is '
                                          '<original logfile>.html'))
        self.argparser.add_argument('--line-max', action='store',
                                    default=10000,
                                    help=('max count of datapoints at which '
                                          'actual log line strings are not '
                                          'printed any more.'))
示例#22
0
 def __init__(self):
     """ Constructor: add description to argparser. """
     LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=False)
     
     self.argparser.description = 'Extracts general information from logfile and prints it to stdout.'
     self.argparser.add_argument('--restarts', action='store_true', help='outputs information about every detected restart.')
示例#23
0
 def __init__(self):
     """ Constructor: add description to argparser. """
     LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)
     
     self.argparser.description = 'mongod/mongos log file to json converter. \
示例#24
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'mongod/mongos log file version detector. Parses a log file and matches each line to its original source code version. Each line that limits the remaining possible set of versions is printed. If a mongos/d restart is detected, the definitive version is printed instead.'
示例#25
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'Anonymizes log files by replacing IP addresses, namespaces, strings.'
        self.replacements = {}
示例#26
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'mongod/mongos log file visualizer (browser edition). Extracts \
示例#27
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'mongod/mongos log file version detector. Parses a log file and matches each line to its original source code version. Each line that limits the remaining possible set of versions is printed. If a mongos/d restart is detected, the definitive version is printed instead.'
示例#28
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'Anonymizes log files by replacing IP addresses, namespaces, strings.'
        self.replacements = {}
示例#29
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'mongod/mongos log file visualizer (browser edition). Extracts \
示例#30
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=True)

        self.argparser.description = ("A script to plot various information "
                                      "from logfiles. Clicking on any of the "
                                      "plot points will print the "
                                      "corresponding log line to stdout.")

        # disable some default shortcuts
        plt.rcParams['keymap.xscale'] = ''
        plt.rcParams['keymap.yscale'] = ''

        # import all plot type classes in plottypes module
        self.plot_types = [
            c[1] for c in inspect.getmembers(plottypes, inspect.isclass)
        ]
        self.plot_types = dict(
            (pt.plot_type_str, pt) for pt in self.plot_types)
        self.plot_instances = []
        self.plot_instance = None

        # main parser arguments
        self.argparser.add_argument('--logscale',
                                    action='store_true',
                                    help=('plot y-axis in logarithmic scale '
                                          '(default=off)'))
        self.argparser.add_argument('--overlay',
                                    action='store',
                                    nargs='?',
                                    default=None,
                                    const='add',
                                    choices=['add', 'list', 'reset'],
                                    help=("create combinations of several "
                                          "plots. Use '--overlay' to create "
                                          "an overlay (this will not plot "
                                          "anything). The first call without "
                                          "'--overlay' will additionally plot "
                                          "all existing overlays. Use "
                                          "'--overlay reset' to clear all "
                                          "overlays."))
        self.argparser.add_argument('--type',
                                    action='store',
                                    default='scatter',
                                    choices=self.plot_types.keys(),
                                    help=("type of plot (default=scatter with "
                                          "--yaxis duration)."))
        self.argparser.add_argument('--title',
                                    action='store',
                                    default=None,
                                    help=("change the title of the plot "
                                          "(default=filename(s))"))
        self.argparser.add_argument(
            '--group',
            help=("specify value to group on. "
                  "Possible values depend on type of "
                  "plot. All basic plot types can "
                  "group on 'namespace','hostname' 'operation', "
                  "'thread', 'pattern', range and "
                  "histogram plots can additionally "
                  "group on 'log2code'. The group can "
                  "also be a regular expression."))
        self.argparser.add_argument('--group-limit',
                                    metavar='N',
                                    type=int,
                                    default=None,
                                    help=("specify an upper limit of the "
                                          "number of groups. Groups are "
                                          "sorted by number of data points. "
                                          "If limit is specified, only the "
                                          "top N will be listed separately, "
                                          "the rest are grouped together in "
                                          "an 'others' group"))
        self.argparser.add_argument('--no-others',
                                    action='store_true',
                                    default=False,
                                    help=("if this flag is used, the 'others' "
                                          "group (see --group-limit) will be "
                                          "discarded."))
        self.argparser.add_argument('--optime-start',
                                    action='store_true',
                                    default=False,
                                    help=("plot operations with a duration "
                                          "when they started instead (by "
                                          "subtracting the duration). The "
                                          "default is to plot them when they "
                                          "finish (at the time they are "
                                          "logged)."))
        self.argparser.add_argument('--ylimits',
                                    action='store',
                                    default=None,
                                    type=int,
                                    nargs=2,
                                    metavar='VAL',
                                    help=("if set, limits the y-axis view to "
                                          "[min, max], requires exactly 2 "
                                          "values."))
        self.argparser.add_argument('--output-file',
                                    metavar='FILE',
                                    action='store',
                                    default=None,
                                    help=("Save the plot to a file instead of "
                                          "displaying it in a window"))
        self.argparser.add_argument('--checkpoints',
                                    action='store_true',
                                    default=None,
                                    help=("plot slow WiredTiger checkpoints"))
        self.argparser.add_argument('--dns',
                                    action='store_true',
                                    help='plot slow DNS resolution',
                                    default=False)
        self.argparser.add_argument('--oplog',
                                    action='store_true',
                                    help=('plot slow oplog application'))
        self.argparser.add_argument('--storagestats',
                                    action='store_true',
                                    default=False,
                                    help=("plot storage statistics for insert "
                                          "and update operations"))

        self.legend = None

        # progress bar
        self.progress_bar_enabled = not self.is_stdin
示例#31
0
    def __init__(self):
        LogFileTool.__init__(self, multiple_logfiles=True, stdin_allowed=False)

        self.argparser.add_argument('--labels', action='store', nargs='*', default=['enum'], help='labels to distinguish original files. Choose from none, enum, alpha, filename, or provide list.')
        self.argparser.add_argument('--pos', action='store', default=0, help="position of label (default=0, front of line, other options are 'eol' or the position as int.")
        self.argparser.add_argument('--timezone', action='store', nargs='*', default=[], type=int, metavar="N", help="timezone adjustments: add N hours to corresponding log file")
示例#32
0
    def __init__(self):
        """ Constructor: add description to argparser. """
        LogFileTool.__init__(self, multiple_logfiles=False, stdin_allowed=True)

        self.argparser.description = 'mongod/mongos log file to json converter. \