Skip to content

网关性能分析和日志可视化【此项目已经不维护了】

License

Notifications You must be signed in to change notification settings

withlin/kong-logs-metrics

Repository files navigation

Kong Statistical Analysis Of Performance

KongApi Gateway Log Metrics 后台是基于 go 写的,web框架采用的gin,前台用的是Vue,UI组件 采用的是iView

预览(OverView)

效果图,如下所示:

折柱混合(报表)

饼状图 (报表)

表格

日志可视化

Getting Started

//Logstash 配置参考
input {
  tcp {
    type => "tcp"
    port => 6666
    mode => "server"
  }
}
filter  {
      json {
            source => "message"
        }
      date {
        match => ["started_at", "yyyy-MM-dd HH:mm:ss,SSS", "UNIX_MS"]
        target=>"started_at"
        locale => "cn"
        timezone => "Asia/Shanghai"
    }
}
output {
  elasticsearch { hosts => ["localhost:9200"] }
  stdout { codec => rubydebug }
}




使用kong dashboard添加插件tcp log插件,配置的地址就写logstash的地址,端口为上面配置设置的端口

git clone https://github.com/DevWithLin/kong-logs-metrics.git

cd  kong-logs-metrics

##如何编译?

//下载 dep包管理工具
go get -u github.com/golang/dep/cmd/dep


//安装依赖
dep ensure


vim config.yml
配置说明

elasticsearch:
  host: http://192.168.199.17:9200/   //ES地址
  setsniff: false  
  logstashtype: logs                  //索引类型

go:
  apiprefix: /v1/api                 //api 分组
  port: 7777                        //端口
  tokenmaxage: 10800                //Token过期时间
  env: development                  //开发环境
  logdir:                           //日志文件夹
  tokensecret: AstrRAflaEAA          //JWT的字符串

mysql: 
    dialect: mysql                  
    database: test
    user: root
    passowrd: 000000
    charset: utf8mb4
    host: 192.168.199.16
    port: 3306
    maxidleconns: 5
    maxopenconns: 10

redis: 
    host: 192.168.199.17
    port: 6379
    passowrd: zzzzzzz
    maxIdle: 3
    maxactive: 5

//启动后台服务
go run main.go


cd  kong-logs-metrics/website


//还原依赖  注意:Node版本使用v8.10.0 最新版本不兼容(webpack)
npm i 或者 cnpm i

//启动前端项目
npm run dev


//如果后台部署到其他的服务器上 需要修改前端地址

vim  kong-logs-metrics/website/src/api/index.js

let serverAddress='http://localhost:7777/v1/api'; //修改此处服务端地址即可

//发布项目

npm run build  //然后把项目静态文件部署到nginx上。

About

网关性能分析和日志可视化【此项目已经不维护了】

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published