def set_syslog_ng_configuration():
    '''
    syslog ng have a default configuration which enables the incoming ports and define
    the source pipe to the daemon this will verify it is configured correctly
    :return:
    '''
    comment_line = False
    snet_found = False
    with open(syslog_ng_conf_path, "rt") as fin:
        with open("tmp.txt", "wt") as fout:
            for line in fin:
                # fount snet
                if "s_net" in line and not "#":
                    snet_found = True
                # found source that is not s_net - should remove it
                elif "source" in line and "#" not in line and "s_net" not in line and "log" not in line:
                    comment_line = True
                # if starting a new definition stop commenting
                elif comment_line is True and "#" not in line and ("source" in line or "destination" in line or "filter" in line or "log" in line):
                    # stop commenting out
                    comment_line = False
                # write line correctly
                fout.write(line if not comment_line else ("#" + line))
    command_tokens = ["sudo", "mv", "tmp.txt", syslog_ng_conf_path]
    write_new_content = subprocess.Popen(command_tokens, stdout=subprocess.PIPE)
    time.sleep(3)
    o, e = write_new_content.communicate()
    if e is not None:
        handle_error(e, error_response_str="Error: could not change Rsyslog.conf configuration  in -" + syslog_ng_conf_path)
        return False
    if not snet_found:
        append_content_to_file(line=syslog_ng_source_content, file_path=syslog_ng_conf_path)
    print_ok("Rsyslog.conf configuration was changed to fit required protocol - " + syslog_ng_conf_path)
    return True

    syslog ng have a default configuration which enables the incoming ports and define
    the source pipe to the daemon this will verify it is configured correctly
    :return:
    
DataConnectors/CEF/cef_installer.py