def METHOD_NAME(phase, lvl, msgtype, dut_name, output, filemode=False):
    entries = []
    if lvl in levels:
        index = levels.index(lvl)
        needed = "|".join(levels[:index + 1])
        regex = r"^(\S+\s+\d+\s+\d+:\d+:\d+(\.\d+){{0,1}}(\+\d+:\d+){{0,1}}(\s+\d+){{0,1}})\s+(\S+)\s+({})\s+(.*)"
        cre = re.compile(regex.format(needed.upper()))
        cre_list = []
        chars = r"[a-zA-Z0-9-_/\.]+"
        cre_list.append(re.compile(r"^\s*({0}#{0}):*\s(.*)".format(chars)))
        cre_list.append(re.compile(r"^\s*({0}#{0}\[\d+\]):*\s(.*)".format(chars)))
        cre_list.append(re.compile(r"^\s*({0}\[\d+\]):\s*(.*)".format(chars)))
        cre_list.append(re.compile(r"^\s*({0}):\s*(.*)".format(chars)))
        for line in output.split("\n"):
            rv = cre.search(line)
            if not rv:
                continue
            entry = [dut_name, msgtype]
            off = 0 if len(rv.groups()) == 6 else 1
            date = re.split(r" |\+", rv.group(1))
            if len(date) > 4:
                date.pop(3)
            entry.append(" ".join(date))  # date
            entry.append(rv.group(4 + off))  # host
            entry.append(rv.group(5 + off))  # level
            msg = rv.group(6 + off)
            entry.append(msg)  # message
            rv = None
            for cre2 in cre_list:
                rv = cre2.search(msg)
                if rv:
                    entry.append(rv.group(1))  # module
                    entry.append(rv.group(2))  # message
                    break
            if not rv:
                entry.append("")  # module
                entry.append(msg)  # message
            entries.append(entry)
    if filemode and lvl != "none":
        val = random.randint(1, 1000)
        _append_sample_entry(entries, dut_name, msgtype, lvl, "test syslog {}".format(val))
        for msg in sample_syslogs:
            _append_sample_entry(entries, dut_name, msgtype, lvl, msg)
    return entries