Background: Sometimes the program even if the parameter is less or not submitted to the next link in the URL after the problem, how to check it, the best way is to add the post parameters on the Nginx, to locate the problem can be a UiR code to troubleshoot problems.
Og_format access ' $remote _addr-$remote _user [$time _local] "$request" $status $body _bytes_sent $request _body "$http _ Referer "" $http _user_agent "$http _x_forwarded_for ';
Access_log Logs/test.access.log access;
Note the placement in http: nginx: [Warn] the "log_format" directive May is used only on "HTTP" level in/usr/local/nginx/conf/vhost/xxx. conf:59
Nginx.conf
HTTP definition: Wwwlog
Log_format wwwlog ' $remote _addr-$remote _user [$time _local] "$request" '
' $status $body _bytes_sent ' $http _referer '
' "$http _user_agent" $http _x_forwarded_for "$request _time";
Add Wwwlog to the include each domain name:
Access_log/data/logs/access_mytv.log Wwwlog;
So after the same access, write this:
Nginx.conflog_format access ' $remote _addr-$remote _user [$time _local] "$request" $status $body _bytes_sent $request _ Body "$http _referer" "$http _user_agent" $http _x_forwarded_for '; included Justwinit.conf:access_log /data/logs/access _mytv.log Access
The logs are as follows:
202.108.16.77--[14/jan/2015:10:45:45 +0800] "Post/partin/releaseinfo http/1.1" 302 5 id=47&choice_type=new& Eid=338&videoid=5d6dabda-9b97-11e4-9584-21fa84a4ab6e&file_ext=mp4&lang=zh&upload_server= 202.108.17.15&title=7%e5%b2%81%e5%b0%8f%e5%ad%a9%e9%85%92%e7%93%b6%e4%b8%8a%e5%81%9a%e4%bf%af%e5%8d%a7%e6% 92%91%e8%b9%bf%e7%ba%a2%e7%bd%91%e7%bb%9c&desc=7%e5%b2%81%e5%b0%8f%e5%ad%a9%e9%85%92%e7%93%b6%e4%b8%8a%e5% 81%9a%e4%bf%af%e5%8d%a7%e6%92%91%e8%b9%bf%e7%ba%a2%e7%bd%91%e7%bb%9c&tags=%e6%b5%8b%e8%af%95%e4%b8%80%e4% B8%8b%e3%80%82&checkflag=on "HTTP://JUSTWINIT.CN/PARTIN/SHOWUPLOAD/ACTIVITYID/47" "mozilla/5.0 (Windows NT 6.1; rv:34.0) gecko/20100101 firefox/34.0 "-
POST URI and Parameters: Post/partin/releaseinfo http/1.1 "302 5 .....
From the refer URI:HTTP://JUSTWINIT.CN/PARTIN/SHOWUPLOAD/ACTIVITYID/47
This access_log Log_format should be able to define multiple different names for different log requirements.
Then there
The parameters of the GET request are stored in the HTTP header, so modifying the header's size limit can certainly solve the problem of too long a request string.
Mobile Internet industry development process, the service side often need to check whether to receive the request, received what kind of request, the simplest way is to see Nginx access log, common Nginx configuration in the access log is generally only get request parameters, The parameters of the post request are not.
Http://wiki.nginx.org/NginxHttpCoreModule#.24request_body
$request _body
This variable (0.7.58+) contains the body of the request. The significance of this variable appears in locations with Directives proxy_pass or Fastcgi_pass.
As shown in the previous file, you only need to use $request_body to post data, and in the existing server segment add the following settings:
Log_format access ' $remote _addr-$remote _user [$time _local] "$request" $status $body _bytes_sent $request _body "$http _ Referer "" $http _user_agent "$http _x_forwarded_for ';
Access_log Logs/test.access.log access;
- This article is from: Linux Learning Network
Record the parameter value of the POST request in Access log of the Nginx log