def validate_workspace(workspace_id):
    """
    Check if the given workspace is the one connected to the agent
    """

    grep1 = subprocess.Popen(["grep", "-ri", "WORKSPACE_ID=", oms_agent_extract_ws_id_url], stdout=subprocess.PIPE)
    grep2 = subprocess.Popen(["grep", "-v", "%"], stdin=grep1.stdout, stdout=subprocess.PIPE)
    o, e = grep2.communicate()
    output_decoded = o.decode(encoding='UTF-8')
    if e is not None:
        print_error("Failed to validate agent's workspace")
    elif output_decoded is not None and output_decoded != "":
        # Extract the workspace id from the agent configuration
        current_ws_id = re.search("(?<=WORKSPACE_ID=).*", output_decoded).group(0)
        if current_ws_id != workspace_id:
            print_error(
                "Failed to run the script.\n"
                "The omsagent installed on the machine is already connected to a different workspace- {}"

                .format(current_ws_id))
            sys.exit()

    Check if the given workspace is the one connected to the agent
    
DataConnectors/CEF/TimeGenerated.py