Nginx log format design

Source: Internet
Author: User
Nginx log format design according to the development requirements, we need to print some special information in the nginx log, so some logs must be customized, # set the default user_id value set $ user_id & quot; 0 & quot; # set the default value set $ user_kind & quot;-& quot; # set the default value set of uuid...
Nginx log format design according to the development requirements, we need to print some special information in the nginx log, so some logs must be customized, # set the default value of user_id set $ user_id "0 "; # set $ user_kind "-"; # set the default uuid value set $ uuid "_"; www.2cto.com if ($ http_cookie ~ * "User_id = ([0-9] *)") {set $ user_id $1;} if ($ http_cookie ~ * "User_kind = ([0-9] *)") {set $ user_kind $1;} www.2cto.com if ($ http_cookie ~ * "_ Uuid = ([A-Za-z0-9] *)") {set $ uuid $1;} nginx location module detailed parameter introduction Nginx Location can have the following Matching: 1. = strictly match this query. If yes, stop searching. 2. ^ ~ Match the path prefix. if it is found, stop searching. 3 .~ 4 .~ * Case-insensitive matching: 5 .!~ And !~ * Case-insensitive and case-insensitive do not match files and directories *-f and! -F is used to determine whether a file exists *-d and! -D is used to determine whether a directory *-e and! -E is used to determine whether a file or directory exists *-x and! -X is used to determine whether the file can execute some available global variables $ args $ content_length $ content_type $ document_root $ document_uri $ host $ http_user_agent $ http_cookie $ limit_rate $ response $ request_method $ remote_addr $ remote _ $ remote_user $ request_filename $ request_uri $ query_string $ scheme $ server_protocol $ server_addr $ server_name $ server_port $ uri www.2cto.com the flag after rewrite can be: last break redirect permanent proxy_pass http://localhost:80;proxy_set_header Host $ host; automatically changes the domain name information after forwarding.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.