# file2udp **Repository Path**: tianjingle/file2udp ## Basic Information - **Project Name**: file2udp - **Description**: 使用golang开发的侵入式采集工具,支持多个文件监听,实现增量日志转出到Udp能力,支持window、linux - **Primary Language**: Go - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: https://gitee.com/tianjingle/file2udp - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-11-12 - **Last Updated**: 2023-11-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # file2Udp原理 类似于CAS原理,给予检测时间片之内文件变动,通过指针滑动读时间片内的增量日志,实现`tail -f`的能力。目前支持`window、linux(x86)、linux(arm)`版本.file2udp开发采用第三方组件: ```shell github.com/hpcloud/tail ``` # 开始使用 1. [查找](https://gitee.com/tianjingle/file2udp/releases)到适合自己的版本并下载; 2. 编辑`conf`文件夹下的配置文件`server.ini` ```shell [system] collector.default.files = C:\Users\Administrator\GolandProjects\awesomeProject\1.txt,C:\Users\Administrator\GolandProjects\awesomeProject\2.txt collector.default.addr = 127.0.0.1:8888 collector.test.files = C:\Users\Administrator\GolandProjects\run.txt,C:\Users\Administrator\GolandProjects\test.log collector.test.addr = 127.0.0.1:8889 ``` #### 配置说明 - `collector.类型.files = `需要监听的文件,多个文件用`,`隔开 - `collector.类型.addr =`当前类型的文件需要转出的udp地址 3. 根据版本执行run.sh、run.vbs启动日志转出,执行stop.sh、stop.vbs停止日志. * 注意: 配置变动均需重启file2Udp进程 # 构建出包 ```shell # linux_x86构建 set GOARCH=amd64 go env -w GOARCH=amd64 set GOOS=linux go env -w GOOS=linux go build ./ # window构建 set GOARCH=amd64 go env -w GOARCH=amd64 set GOOS=windows go env -w GOOS=windows go build ./ # linux_arm环境构建 set GOARCH=arm64 go env -w GOARCH=arm64 set GOOS=linux go env -w GOOS=linux go build ./ ```