从 Nginx 的日志中读取数据,格式化数据,并存入后端数据库
只支持 postgres 数据库
$ ngxmetric access.log程序会读取相同目录下的 config/config.ini 文件
在文件里面配置是数据库的相关信息
$ cat config/config.ini
[database]
host=localhost
port=5432
username=postgres
password=postgres
dbname=metric
make build测试需要数据库的支持
使用项目中的 docker-compose 文件可以创建一个 postgres 数据库
执行
$ docker-compose up -d
$ make test$ make cover
... coverage: 81.6% of statements
...将真实的 nginx access.log 文件复制到 testdata/ 目录下面, 然后运行
$ make test-with-bigfile