在默认主机里面加上location或者你希望能访问到的主机里面。 server { location /nginx-status { stub_status on; #access_log /home/www/phpernote/nginx_status.log;//访问日志,这里可以设置为off将其关闭 access_log off; #allow 127.0.0.1;#允许访问的IP #deny all; } } 1. 2. 3. 4. 5. 6. 7....
官方文档:http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format#修改配置文件的日志格式: vi /usr/local/nginx/conf/nginx.conf #在http模块中添加 log_format json'{"@timestamp":"$time_iso8601",' '"@version":"1",' '"client":"$remote_addr",' '"url":"$uri",' '"status...
' '"status":"$status",' '"domain":"$host",' '"host":"$server_addr",' '"size":$body_bytes_sent,' '"responsetime":$request_time,' '"referer": "$http_referer",' '"ua": "$http_user_agent"' '}'; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_time...
①、方式一log_format log_json'{"@timestamp": "$time_iso8601","remote_addr": "$remote_addr","remote_user": "$remote_user","request_method": "$request_method","uri":"$uri","query_string":"$query_string","status":"$status","body_bytes_sent":"$body_bytes_sent","http_referrer"...
log_format main '$remote_addr - $remote_user [$time_local] "$request" ''$status$body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for" $request_time$upstream_response_time';打印的日志实例 39.105.66.117-mp[11/Sep/2019:19:03:01+0800]"POST /salesplatform...
log_format main '{"http_x_forwarded_for":"$http_x_forwarded_for","remote_user":"$remote_user","time_local":"$time_local","request":"$request","status":"$status","body_bytes_sent":"$body_bytes_sent","request_body":"$request_body","http_referer":"$http_referer","remote_addr"...
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_response_time'; 打印的日志实例 代码语言:txt ...
进入logstash文件夹,新建配置文件test.conf cd /opt/logstash vim test.conf input{ file{ path => "/usr/logs/access.log" start_position => "beginning" codec => json } } filter { ruby { init => "@kname = ['remote_addr','remote_user','time_local','request','status','body_bytes...
1……2log_format proxy'$remote_addr - $remote_user [$time_local] "$request" '3'$status $body_bytes_sent "$http_referer" '4'"$http_user_agent" "$http_user_agent" ';5…… 配置相关变量释义: $remote_addr:表示客户端地址; $remote_user:表示http客户端请求Nginx认证的用户名; ...
1.采用logstash收集/过滤数据 1.1 具体安装请看https://www.elastic.co/官方文档 1.2 logstash配置 1.2.1 从nginx收集数据,首先配置一下nginx的日志格式 log_format main'$remote_addr - $http_host $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_...