{"id":16242092,"url":"https://github.com/nhzex/socket-log-server","last_synced_at":"2025-03-19T17:31:08.833Z","repository":{"id":101921398,"uuid":"219506481","full_name":"NHZEX/socket-log-server","owner":"NHZEX","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-22T15:31:32.000Z","size":84,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-22T15:43:18.849Z","etag":null,"topics":["socketlog","swoole","thinkphp"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/NHZEX.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-04T13:20:30.000Z","updated_at":"2024-06-01T01:56:30.162Z","dependencies_parsed_at":"2024-05-22T15:42:19.963Z","dependency_job_id":"4556f8a9-2226-4e80-a85f-c795014c4574","html_url":"https://github.com/NHZEX/socket-log-server","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHZEX%2Fsocket-log-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHZEX%2Fsocket-log-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHZEX%2Fsocket-log-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHZEX%2Fsocket-log-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NHZEX","download_url":"https://codeload.github.com/NHZEX/socket-log-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221729422,"owners_count":16871016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["socketlog","swoole","thinkphp"],"created_at":"2024-10-10T14:09:27.449Z","updated_at":"2024-10-27T20:26:38.362Z","avatar_url":"https://github.com/NHZEX.png","language":"PHP","readme":"# Socket Log Server\n\nthinkphp socket-log 日志转发服务\n\n## 环境需求\n\n- php \u003e= 8.1\n- ext-zlib\n- ext-ctype\n- ext-mbstring\n\n## 启动服务 \n\n### 方法1: Phar\n1. 下载最新 [socket-log.phar](https://github.com/NHZEX/socket-log-server/releases/latest/download/socket-log-server.phar)  \n2. ```php socket-log-server.phar```\n\n### 方法2: Swoole-CLI SFX\n1. 下载最新 [socket-log-linux-sfx](https://github.com/NHZEX/socket-log-server/releases/latest/download/socket-log-linux-sfx)\n2. ```chmod +x socket-log-linux-sfx```\n3. ```./socket-log-linux-sfx --self```\n\n#### 自执行传参方式举例\n```bash\n# 查构建版本号\n./socket-log-linux-sfx --self -- -V\n```\n\n### 方法3: Docker（需要网络代理）\n\n```shell\ndocker pull ghcr.io/nhzex/socket-log-server:latest\n```\n\n## 服务端口 \n  - http server: 1116\n  - websocket: 1229 (提供老浏览器扩展兼容支持)\n\n## 配置使用环境变量或`.env`\n\n```dotenv\n# 工作进程数量，默认1就行，没有调大的价值\nSL_WORKER_NUM=1\n# 主端口监听，支持ipv6（http+ws双协议。不区分客户端连入）\nSL_SERVER_LISTEN=[::]:1116\n# 兼容老客户端的独立端口，默认启用，后续会弃用\nSL_SERVER_BC_LISTEN=0.0.0.0:1229\n# 允许中转连入的客户端ID白名单，为空则不启用\n# 匹配语法参考php函数`fnmatch`：https://www.php.net/manual/en/function.fnmatch.php\nSL_ALLOW_CLIENT_LIST=\"\ndebug?\ntest*\nsl*\n\"\n```\n\n## 公网使用建议\n\n建议套`nginx`代理，反代走`https`,`wss`。\n\n## 自行构建`Phar`\n\n```bash\n# 下载\nwget https://github.com/box-project/box/releases/download/4.3.8/box.phar\n# 构建\nphp -dphar.readonly=false ./box.phar compile\n# 结果\n./bin/socket-log-server.phar\n```\n\n## 构建 swoole-cli sfx\n\n```bash\nswoole-cli ./pack-sfx.php ./bin/socket-log-server.phar ./bin/socket-log-linux-sfx\n```\n\n## systemctl 守护\n\n使用 swoole-cli sfx 二进制包\n\n```ini\n[Unit]\nDescription=socket-log\nAfter=network.target syslog.target\n\n[Service]\nType=simple\nLimitNOFILE=655350\nExecStart=/opt/socket-log/socket-log-linux-sfx --self\nExecReload=/bin/kill -USR1 $MAINPID\nRestart=always\n\n[Install]\nWantedBy=multi-user.target graphical.target\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhzex%2Fsocket-log-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhzex%2Fsocket-log-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhzex%2Fsocket-log-server/lists"}