示例#1
0
    def _find_pattern(self, trigger):

        # get start of json query pattern
        start_idx = self.line_str.rfind(trigger)
        if start_idx == -1:
            # no query pattern found
            return None

        stop_idx = 0
        brace_counter = 0
        search_str = self.line_str[start_idx+len(trigger):]

        for match in re.finditer(r'{|}', search_str):
            stop_idx = match.start()
            if search_str[stop_idx] == '{':
                brace_counter += 1
            else:
                brace_counter -= 1
            if brace_counter == 0:
                break
        search_str = search_str[:stop_idx+1].strip()
        if search_str:
            return json2pattern(search_str)
        else:
            return None
示例#2
0
    def _find_pattern(self, trigger):

        # get start of json query pattern
        start_idx = self.line_str.rfind(trigger)
        if start_idx == -1:
            # no query pattern found
            return None

        stop_idx = 0
        brace_counter = 0
        search_str = self.line_str[start_idx + len(trigger):]

        for match in re.finditer(r'{|}', search_str):
            stop_idx = match.start()
            if search_str[stop_idx] == '{':
                brace_counter += 1
            else:
                brace_counter -= 1
            if brace_counter == 0:
                break
        search_str = search_str[:stop_idx + 1].strip()
        if search_str:
            return json2pattern(search_str)
        else:
            return None
示例#3
0
    def __init__(self, mlogfilter):
        BaseFilter.__init__(self, mlogfilter)

        self.components = None
        self.levels = None
        self.namespaces = None
        self.operations = None
        self.threads = None
        self.commands = None
        self.pattern = None
        self.planSummaries = None

        if 'component' in self.mlogfilter.args and self.mlogfilter.args[
                'component']:
            self.components = custom_parse_array(
                self.mlogfilter.args['component'])
            self.active = True
        if 'level' in self.mlogfilter.args and self.mlogfilter.args['level']:
            self.levels = custom_parse_array(self.mlogfilter.args['level'])
            self.active = True
        if 'namespace' in self.mlogfilter.args and self.mlogfilter.args[
                'namespace']:
            self.namespaces = custom_parse_array(
                self.mlogfilter.args['namespace'])
            self.active = True
        if 'operation' in self.mlogfilter.args and self.mlogfilter.args[
                'operation']:
            self.operations = custom_parse_array(
                self.mlogfilter.args['operation'])
            self.active = True
        if 'command' in self.mlogfilter.args and self.mlogfilter.args[
                'command']:
            self.commands = custom_parse_array(self.mlogfilter.args['command'])
            self.active = True
        if 'thread' in self.mlogfilter.args and self.mlogfilter.args['thread']:
            self.threads = custom_parse_array(self.mlogfilter.args['thread'])
            self.active = True
        if 'pattern' in self.mlogfilter.args and self.mlogfilter.args[
                'pattern']:
            self.pattern = json2pattern(self.mlogfilter.args['pattern'])
            self.active = True
            if self.pattern is None:
                raise SystemExit(
                    "ERROR: cannot parse pattern \"%s\" as a JSON string" %
                    self.mlogfilter.args['pattern'])
        if 'planSummary' in self.mlogfilter.args and self.mlogfilter.args[
                'planSummary']:
            self.planSummaries = custom_parse_array(
                self.mlogfilter.args['planSummary'])
            self.active = True
示例#4
0
    def __init__(self, mlogfilter):
        BaseFilter.__init__(self, mlogfilter)

        self.components = None
        self.levels = None
        self.namespaces = None
        self.operations = None
        self.threads = None
        self.commands = None
        self.pattern = None
        self.planSummaries = None

        if ('component' in self.mlogfilter.args and
                self.mlogfilter.args['component']):
            self.components = custom_parse_array(self.mlogfilter
                                                 .args['component'])
            self.active = True
        if 'level' in self.mlogfilter.args and self.mlogfilter.args['level']:
            self.levels = custom_parse_array(self.mlogfilter.args['level'])
            self.active = True
        if ('namespace' in self.mlogfilter.args and
                self.mlogfilter.args['namespace']):
            self.namespaces = custom_parse_array(self.mlogfilter
                                                 .args['namespace'])
            self.active = True
        if ('operation' in self.mlogfilter.args and
                self.mlogfilter.args['operation']):
            self.operations = custom_parse_array(self.mlogfilter
                                                 .args['operation'])
            self.active = True
        if ('command' in self.mlogfilter.args and
                self.mlogfilter.args['command']):
            self.commands = custom_parse_array(self.mlogfilter.args['command'])
            self.active = True
        if 'thread' in self.mlogfilter.args and self.mlogfilter.args['thread']:
            self.threads = custom_parse_array(self.mlogfilter.args['thread'])
            self.active = True
        if ('pattern' in self.mlogfilter.args and
                self.mlogfilter.args['pattern']):
            self.pattern = json2pattern(self.mlogfilter.args['pattern'])
            self.active = True
            if self.pattern is None:
                raise SystemExit("ERROR: cannot parse pattern \"%s\" as a JSON"
                                 " string" % self.mlogfilter.args['pattern'])
        if ('planSummary' in self.mlogfilter.args and
                self.mlogfilter.args['planSummary']):
            self.planSummaries = custom_parse_array(self.mlogfilter
                                                    .args['planSummary'])
            self.active = True
示例#5
0
    def __init__(self, mlogfilter):
        BaseFilter.__init__(self, mlogfilter)

        self.components = None
        self.levels = None
        self.namespaces = None
        self.operations = None
        self.threads = None
        self.commands = None
        self.pattern = None
        self.planSummaries = None

        if 'component' in self.mlogfilter.args and self.mlogfilter.args[
                'component']:
            self.components = custom_parse_array(
                self.mlogfilter.args['component'])
            self.active = True
        if 'level' in self.mlogfilter.args and self.mlogfilter.args['level']:
            self.levels = custom_parse_array(self.mlogfilter.args['level'])
            self.active = True
        if 'namespace' in self.mlogfilter.args and self.mlogfilter.args[
                'namespace']:
            self.namespaces = custom_parse_array(
                self.mlogfilter.args['namespace'])
            self.active = True
        if 'operation' in self.mlogfilter.args and self.mlogfilter.args[
                'operation']:
            self.operations = custom_parse_array(
                self.mlogfilter.args['operation'])
            self.active = True
        if 'command' in self.mlogfilter.args and self.mlogfilter.args[
                'command']:
            self.commands = custom_parse_array(self.mlogfilter.args['command'])
            self.active = True
        if 'thread' in self.mlogfilter.args and self.mlogfilter.args['thread']:
            self.threads = custom_parse_array(self.mlogfilter.args['thread'])
            self.active = True
        if 'pattern' in self.mlogfilter.args and self.mlogfilter.args[
                'pattern']:
            self.pattern = json2pattern(self.mlogfilter.args['pattern'])
            self.active = True
        if 'planSummary' in self.mlogfilter.args and self.mlogfilter.args[
                'planSummary']:
            self.planSummaries = custom_parse_array(
                self.mlogfilter.args['planSummary'])
            self.active = True
示例#6
0
    def __init__(self, mlogfilter):
        BaseFilter.__init__(self, mlogfilter)

        self.namespace = None
        self.operation = None
        self.thread = None
        self.pattern = None

        if 'namespace' in self.mlogfilter.args and self.mlogfilter.args['namespace']:
            self.namespace = self.mlogfilter.args['namespace']
            self.active = True
        if 'operation' in self.mlogfilter.args and self.mlogfilter.args['operation']:
            self.operation = self.mlogfilter.args['operation']
            self.active = True
        if 'thread' in self.mlogfilter.args and self.mlogfilter.args['thread']:
            self.thread = self.mlogfilter.args['thread']
            self.active = True
        if 'pattern' in self.mlogfilter.args and self.mlogfilter.args['pattern']:
            self.pattern = json2pattern(self.mlogfilter.args['pattern'])
            self.active = True
示例#7
0
    def __init__(self, mlogfilter):
        BaseFilter.__init__(self, mlogfilter)

        self.namespace = None
        self.operation = None
        self.thread = None
        self.pattern = None

        if 'namespace' in self.mlogfilter.args and self.mlogfilter.args[
                'namespace']:
            self.namespace = self.mlogfilter.args['namespace']
            self.active = True
        if 'operation' in self.mlogfilter.args and self.mlogfilter.args[
                'operation']:
            self.operation = self.mlogfilter.args['operation']
            self.active = True
        if 'thread' in self.mlogfilter.args and self.mlogfilter.args['thread']:
            self.thread = self.mlogfilter.args['thread']
            self.active = True
        if 'pattern' in self.mlogfilter.args and self.mlogfilter.args[
                'pattern']:
            self.pattern = json2pattern(self.mlogfilter.args['pattern'])
            self.active = True
示例#8
0
    def __init__(self, mlogfilter):
        BaseFilter.__init__(self, mlogfilter)

        self.components    = None
        self.levels        = None
        self.namespaces    = None
        self.operations    = None
        self.threads       = None
        self.commands      = None
        self.pattern       = None
        self.planSummaries = None

        if 'component' in self.mlogfilter.args and self.mlogfilter.args['component']:
            self.components = custom_parse_array(self.mlogfilter.args['component'])
            self.active = True
        if 'level' in self.mlogfilter.args and self.mlogfilter.args['level']:
            self.levels = custom_parse_array(self.mlogfilter.args['level'])
            self.active = True
        if 'namespace' in self.mlogfilter.args and self.mlogfilter.args['namespace']:
            self.namespaces = custom_parse_array(self.mlogfilter.args['namespace'])
            self.active = True
        if 'operation' in self.mlogfilter.args and self.mlogfilter.args['operation']:
            self.operations = custom_parse_array(self.mlogfilter.args['operation'])
            self.active = True
        if 'command' in self.mlogfilter.args and self.mlogfilter.args['command']:
            self.commands = custom_parse_array(self.mlogfilter.args['command'])
            self.active = True    
        if 'thread' in self.mlogfilter.args and self.mlogfilter.args['thread']:
            self.threads = custom_parse_array(self.mlogfilter.args['thread'])
            self.active = True
        if 'pattern' in self.mlogfilter.args and self.mlogfilter.args['pattern']:
            self.pattern = json2pattern(self.mlogfilter.args['pattern'])
            self.active = True
        if 'planSummary' in self.mlogfilter.args and self.mlogfilter.args['planSummary']:
            self.planSummaries = custom_parse_array(self.mlogfilter.args['planSummary'])
            self.active = True