环境说明

python3+

pip install geoip2==2.9.0

nginx日志配置成json格式,配置如下:

log_format json_log '{ "time": "$time_local", '
                         '"remote_addr": "$remote_addr", '
                         '"remote_user": "$remote_user", '
                         '"body_bytes_sent": "$body_bytes_sent", '
                         '"request_time": "$request_time", '
                         '"status": "$status", '
                         '"request": "$request", '
                         '"request_method": "$request_method", '
                         '"http_referrer": "$http_referer", '
                         '"body_bytes_sent":"$body_bytes_sent", '
                         '"http_x_forwarded_for": "$http_x_forwarded_for", '
                         '"http_user_agent": "$http_user_agent"}';
配置日志成json格式

相关文章:

  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2021-07-18
  • 2021-04-17
  • 2021-04-03
  • 2021-07-24
  • 2021-10-05
猜你喜欢
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-11-27
相关资源
相似解决方案