gos-log 基于Go语言的轻量级高性能的大日志检索系统
开源地址
gos-log
https://gitee.com/dianjiu/gos-log
https://github.com/dianjiu/gos-log
gos-log-vue
https://gitee.com/dianjiu/gos-log-vue
https://github.com/dianjiu/gos-log-vue
演示地址
http://goslog.dianjiu.org.cn
账号:admin
密码:admin
演示截图
登陆页
![image]()
客户端
![image]()
项目管理
![image]()
日志查找
![image]()
项目构建
gos-log
# 进入go工作空间
cd ~/codes/go/src
# 配置go国内代理
sudo vim ~/.bash_profile
# 新增如下内容
export GOPATH=/Users/dianjiu/Codes/go
export GOROOT=/usr/local/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GOPROXY=https://goproxy.cn
export GO111MODULE=on
# 使配置生效
source ~/.bash_profile
# 安装beego依赖
go get github.com/astaxie/beego
go get github.com/beego/bee
# 克隆项目
git clone https://github.com/dianjiu/gos-log.git
# 分别进入项目目录
cd gos-log/logs #进入服务端
cd gos-log/logc #进入客户端
# 启动服务
bee run
gos-log-vue
# 克隆项目
git clone https://github.com/dianjiu/gos-log-vue.git
# 进入项目目录
cd gos-log-vue
# 安装依赖
yarn install
# 启动服务
yarn run dev
项目部署
gos-log
# 打包服务端
cd gos-log/logs
bee pack -be GOOS=linux
# 打包客户端
cd gos-log/logc
bee pack -be GOOS=linux
# 准备数据库 见gos-log项目下的sql文件夹
gos-log-logs
# 解压缩
tar -zxf logs.tar.gz -C ./
# 授权
chmod 777 logs
# 修改数据库配置
sudo vim conf/app.conf
# 启动
nohup ./logs >> logs.log &
gos-log-logc
# 解压缩
tar -zxf logc.tar.gz -C ./
# 授权
chmod 777 logc
# 启动
nohup ./logc >> logc.log &
gos-log-vue
# 打包构建
yarn run build
# 把dist目录下的文件拿到服务器部署即可
# nginx部署如下nginx.conf
server {
listen 2022;
server_name localhost;
location / {
root /web/gos-log/vue;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:2021;
}
}
性能测试
系统硬件
| CPU |
Intel® Core™ i5-10210U CPU @ 1.60GHz × 8 |
| 内存 |
16G |
| 硬盘 |
512.1 GB |
| 操作系统 |
Ubuntu 20.04.2 LTS 64位 |
| GNOME版本 |
3.36.8 |
系统环境
| Java环境 |
ORACLE JDK13.0.2 |
| Go环境 |
GO1.15.7 linux/amd64 |
| Python环境 |
Python 3.8.5 |
性能对比
单文件逐行读取 17.8G test.log (单线程读取)
| 语言 |
test1 |
test2 |
test3 |
test4 |
test5 |
总耗时 |
平均耗时 |
| Go |
32.99s |
34.24s |
30.33s |
31.21s |
35.70s |
164.16s |
32.83s |
| Python |
32分钟还没执行完 |
|
|
|
|
|
|
| Java |
226s |
206s |
153s |
219s |
183s |
987s |
197.4s |