{"id":34577121,"url":"https://github.com/erning/zmqcat","last_synced_at":"2026-05-28T11:31:43.806Z","repository":{"id":5351905,"uuid":"6537712","full_name":"erning/zmqcat","owner":"erning","description":"Simple tool to publish text file line by line","archived":false,"fork":false,"pushed_at":"2013-01-06T03:54:41.000Z","size":102,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-11T05:29:41.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-05T01:19:38.000Z","updated_at":"2013-12-11T12:27:20.000Z","dependencies_parsed_at":"2022-07-06T02:31:06.588Z","dependency_job_id":null,"html_url":"https://github.com/erning/zmqcat","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/erning/zmqcat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erning%2Fzmqcat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erning%2Fzmqcat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erning%2Fzmqcat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erning%2Fzmqcat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erning","download_url":"https://codeload.github.com/erning/zmqcat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erning%2Fzmqcat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33607334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T09:56:13.778Z","updated_at":"2026-05-28T11:31:43.799Z","avatar_url":"https://github.com/erning.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zmqcat\n\n一个将标准输入以ZMQ广播方式广播的工具。这样可以将日志文件通过ZMQ广播出去。\n\n\n例如将syslog通过5678端口广播，可以通过以下命令\n\n```sh\n$ tail -F /var/log/syslog | zmqcat \"tcp://*:5678\"\n```\n\n然后再写一个接收程序处理这些信息。下面示例的python程序简单地将收到的信息输出。\n\n```python\nimport zmq\n\ncontext = zmq.Context()\nsocket = context.socket(zmq.SUB)\n\nsocket.connect(\"tcp://127.0.0.1:5678\")\nsocket.setsockopt(zmq.SUBSCRIBE, \"\")\n\nwhile True:\n    s = socket.recv()\n    print s,\n```\n\n有的时候，日志文件非常大，我们希望能够直接处理这些日志，而不需要写入硬盘后再从硬盘中读出处理。\n\n例如xdebug的输出只能定义到文件，而且输出量特别大。我们可以在xdebug中配置，将输出文件指定到一个FIFO设备(例如xdebug.fifo)，并且通过zmqcat广播。\n\n```sh\n$ mkfifo xdebug.fifo\n$ tail -F xdebug.fifo | zmqcat\n```\n\n注意：当没有进程读取这个FIFO文件时，xdebug的日志写入操作将被block。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferning%2Fzmqcat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferning%2Fzmqcat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferning%2Fzmqcat/lists"}