
运维服务
docker离线安装
一、准备工作:确认架构并下载安装包 1.1 确认目标服务器架构 在目标服务器上执行以下命令,确认系统架构: 输出 x8664:对应 amd64 架构(Intel/AMD 64位服务
| 参数 | 说明 | 实例 |
|---|---|---|
| $remote_addr | 客户端地址 | 114.114.114.114 |
| $remote_user | 客户端用户名称 | -- |
| $time_local | 访问时间和时区 | 18/Jul/2019:17:00:01 +0800 |
| $request | 请求的URI和HTTP协议 | GET / HTTP/1.1 |
| $http_host | 请求地址 | www.wulaoer.org |
| $status | HTTP请求状态 | 200 |
| $upstream_status | upstream状态 | 200 |
| $body_bytes_sent | 发送给客户端文件内容大小 | 13200 |
| $http_referer | url跳转来源 | https://www.baidu.com/ |
| $http_user_agent | 用户终端浏览器等信息 | "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; GTB7.0; .NET4.0C; |
| $ssl_protocol | SSL协议版本 | TLSv1 |
| $ssl_cipher | 交换数据中的算法 | RC4-SHA |
| $upstream_addr | 后台upstream的地址,即真正提供服务的主机地址 | 10.10.10.100:80 |
| $request_time | 整个请求的总时间 | 0.205 |
| $upstream_response_time | 请求过程中,upstream响应时间 | 0.002 |
log_format logstash_json '{ "visit_time": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"body_bytes_sent": $body_bytes_sent, '
'"request_time": $request_time, '
'"status": "$status", '
'"request": "$request", '
'"request_body": "$request_body", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"cookie_uuid": "$cookie_uuid_var", '
'"original_cookie_uuid": "$cookie_uuid", '
'"neo_id": "$http_x_nhn_user_id_no", '
'"neo_user_id": "$http_x_nhn_user_id", '
'"neo_svc_cd": "$http_x_nhn_svc_cd", '
'"neo_sns_id": "$http_x_nhn_sns_id", '
'"neo_sns_cd": "$http_x_nhn_sns_cd", '
'"http_user_agent": "$http_user_agent" } ';
并把日志输出的格式修改一下默认是main
access_log /home/wwwlogs/access.log; #这是系统默认的日志格式 access_log /home/wwwlogs/access_json.log logstash_json; #自定义的日志格式重新加载一个nginx,让配置文件生效
/etc/init.d/nginx reload查看一下日志输出路径下的文件格式:
[root@wulaoer wwwlogs]# ls access-20190923.log access-20190929.log access_json.log access.log nginx_error.log nginx.pidnginx日志格式已经修改完成,后面就是对日志格式进行分割,可以使用工具也可以自己写脚本,下面看一下我的简单些的脚本:
#!/bin/bash logspath=/home/wwwlogs/ logdate=`date +%Y%m%d` cd $logspath mv access.log access-$logdate.log mv access_json.log access_json-$logdate.log /etc/init.d/nginx reload定时任务区执行这个脚本就可以了。
评论 0