def check_for_errors(tech):
    """checks the IDS output for error messages"""
    print_debug("check_for_errors() called")
    error_lines = []
    try:
        ids_log_fh = open(JOB_IDS_LOG, "r")
        for line in ids_log_fh:
            if tech.startswith("suri"):
                if (
                    "<Error>" in line
                    or "Error: " in line
                    or line.startswith("ERROR")
                    or line.startswith("Failed to parse configuration file")
                ):
                    error_lines.append(line)
                    if "bad dump file format" in line or "unknown file format" in line:
                        error_lines.append(
                            "Bad pcap file(s) submitted to Suricata. Pcap files should be in libpcap format (pcapng is not supported in older Suricata versions).\n"
                        )
            elif tech.startswith("snort"):
                if (
                    "ERROR:" in line
                    or "FATAL" in line
                    or "Fatal Error" in line
                    or "Segmentation fault" in line
                    or line.startswith("Error ")
                ):
                    error_lines.append(line)
                    if "unknown file format" in line:
                        error_lines.append(
                            "Bad pcap file(s) submitted to Snort. Pcap files should be in libpcap or pcapng format.\n"
                        )
            else:
                logger.warn(
                    f"Unexpected engine value passed to check_for_errors(): {tech}"
                )
        ids_log_fh.close()
    except Exception as e:
        print_error(
            "Error reading IDS output file '%s'. Error:\n\n%s" % (JOB_IDS_LOG, e)
        )

    if len(error_lines) > 0:
        print_error(
            'Error message(s) found in IDS output. See "IDS Engine" tab for more details and/or context:\n\n%s'
            % "\n".join(error_lines)
        )
checks the IDS output for error messages
dalton-agent/dalton-agent.py