为了方便统计个客户访问后台状态等,决定吧access_log入库

例如:

{"remote_addr":"10.77.40.3, 119.xxx.xxx.149","local_addr":"100.xxx.xxx.124","user":"xxxx@xxxxx.com","time":"[08/Nov/2017:11:20:18 +0800]","url":"POST /api/v1/applicant/risk?source=vc1.2 HTTP/1.0","status":"200","body_bytes_sent":"133","request":"117"}

这样一条json格式的日志,我先把它变成sql语句

命令:

数据库的准备:

create database test;

create table(remote_addr char(64),local_addr char(64),user char(64),time char(64),url char(64),status char(64),body_bytes_sent char(64),request char(64));

表里定义可根据自己需求更改。

导入数据:

mysql -uroot -pxxxxxxxxx test < /root/input.sql

相关文章:

  • 2022-01-06
  • 2021-11-18
  • 2021-11-11
  • 2021-12-20
  • 2022-02-21
  • 2022-02-21
  • 2021-06-07
猜你喜欢
  • 2021-05-06
  • 2022-01-06
  • 2022-03-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-11-20
相关资源
相似解决方案