def start_suricata_daemon(self, config):
        """Start Suricata thread with Unix Socket listener."""
        logger.debug("start_suricata_daemon() called")
        self.reset_logging()
        if config is None:
            print_error("start_suricata_daemon() called but not initialized.")
        # start Suri
        suricata_command = f"suricata -c {config} -k none --runmode single --unix-socket={SURICATA_SOCKET_NAME} -D"
        print_debug(
            f"Starting suricata thread with the following command:\n{suricata_command}"
        )
        # use Popen() instead of call() since the latter blocks which isn't what we want
        subprocess.Popen(suricata_command, shell=True)
        # wait for Suricata to be ready to process traffic before returning
        # tail suricata_logging_outputs_file (default /tmp/dalton-suricata.log),
        # look for "engine started."
        with open(suricata_logging_outputs_file, "r") as suri_output_fh:
            logger.debug(
                "tailing '%s' to see when engine has started up fully"
                % suricata_logging_outputs_file
            )
            now = datetime.datetime.now()
            keep_looking = True
            while keep_looking:
                line = suri_output_fh.readline()
                if not line or not line.endswith("\n"):
                    time.sleep(0.1)
                    continue
                self.suri_startup_log += line
                if "engine started" in line.lower():
                    self.log_offset = suri_output_fh.tell()
                    break
                if "<Error>" in line or "Error: " in line:
                    # submit_job() errors out before JOB_IDS_LOG is copied so
                    # copy over output log to JOB_IDS_LOG here so it gets returned
                    shutil.copyfile(suricata_logging_outputs_file, JOB_IDS_LOG)
                    self.suricata_is_running = False
                    print_error(f"Problem starting Suricata daemon: {line}")
                else:
                    new_now = datetime.datetime.now()
                    if (new_now - now).seconds > 120:
                        # timeout
                        shutil.copyfile(suricata_logging_outputs_file, JOB_IDS_LOG)
                        self.suricata_is_running = False
                        print_error("Timeout waiting on Suricata daemon to start.")

        self.suricata_is_running = True
        logger.debug("Suricata daemon started")
Start Suricata thread with Unix Socket listener.
dalton-agent/dalton-agent.py