Create an Nginx Collection Policy

<p class="shortdesc">This article describes how to create an Nginx collection policy for a host group.</p> <section class="section prereq" id="Create_Nginx_Strategy__prereq_lfv_ssz_wmb"><div class="tasklabel"><h2 class="doc-tairway">Before you begin</h2></div> <ol class="ol" id="Create_Nginx_Strategy__ol_rjf_ykl_wnb"> <li class="li">You have successfully created a host group. For more information, see Create a Host Group.</li> <li class="li">You have successfully installed the Nginx component.<div class="note important note_important"><span class="note__title">Important:</span> You can install the Nginx component only on Linux or Unix operating systems.</div></li> <li class="li">For the system to accurately extract log data, make sure the customized Nginx access log format is consistent with the Nginx log format configured in a collection policy.</li> </ol> </section> <section class="section context"><div class="tasklabel"><h2 class="doc-tairway">About this task</h2></div> <p class="p">To collect logs from cloud hosts in a host group, make sure the following prerequisites are met:</p> <ul class="ul" id="Create_Nginx_Strategy__ul_a5l_wkl_wnb"> <li class="li"><strong class="ph b">Log collection clients</strong>—Ping An Cloud automatically installs a log collection client on each cloud host in the host group.</li> <li class="li"><strong class="ph b">Collection policies</strong>—Configure collection policies for the host group in the console.</li> </ul> <p class="p">Ping An Cloud Log Service provides Nginx collection templates for the open-source general Nginx load balancing component. You can easily use Log Service in its console.</p> </section> <section><div class="tasklabel"><h2 class="doc-tairway">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand"> <span class="ph cmd"> Log in to the<a class="xref" href="/console/logcloud/indexed/list" target="_blank">Log Service Console</a>。</span> </li><li class="li step stepexpand"> <span class="ph cmd">In the left navigation pane, click <strong class="ph b">Project Management</strong>.</span> </li><li class="li step stepexpand"> <span class="ph cmd">On the <strong class="ph b">Project Management</strong> page, select the target region.</span> </li><li class="li step stepexpand"> <span class="ph cmd">Click the target project name.</span> </li><li class="li step stepexpand"> <span class="ph cmd">Click the <strong class="ph b">AGENT CONFIG</strong> tab.</span> </li><li class="li step stepexpand"> <span class="ph cmd">In the upper-right corner of the page, click <strong class="ph b">Create Config</strong>.</span> </li><li class="li step stepexpand"> <span class="ph cmd">On the <strong class="ph b">Create Config</strong> page, create an Nginx collection policy as described in the following table:</span> <div class="itemgroup info"> <table class="table" id="Create_Nginx_Strategy__table_tmm_ctz_wmb"><caption></caption><colgroup><col><col></colgroup><thead class="thead"> <tr class="row"> <th class="entry" id="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1">Configuration item</th> <th class="entry" id="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2">Description</th> </tr> </thead><tbody class="tbody"> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1 "> <p class="p">Data Type</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2 "> <p class="p">Select log type <strong class="ph b">Nginx</strong>. </p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1 "> <p class="p">Name</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2 "> <p class="p">Configure the name of the Nginx collection policy. </p> <ul class="ul" id="Create_Nginx_Strategy__ul_bfh_hll_wnb"> <li class="li">Supported characters are Chinese characters, uppercase and lowercase letters, digits, and special characters including underscores (_), hyphens (-), and at signs (@).</li> <li class="li"> The length of the policy name is 1 to 45 characters.</li> </ul> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1 "> <p class="p">Log Path</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2 "> <p class="p">Configure the absolute path of the log to be collected on the cloud hosts.</p> <div class="note note note_note"><span class="note__title">Note:</span> <ul class="ul" id="Create_Nginx_Strategy__ul_i43_jll_wnb"> <li class="li">The path must be specific to the file.</li> <li class="li">Subdirectories are not scanned by default.</li> <li class="li">Separate multiple paths with commas (,).</li> </ul> </div> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1 "> <p class="p">Archive Or Not</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2 "> <p class="p">Select whether to archive the collected log files to the Ping An Cloud storage devices.</p> <ul class="ul" id="Create_Nginx_Strategy__ul_axm_kll_wnb"> <li class="li"><strong class="ph b">Yes</strong>—Logs can be saved on Ping An Cloud for one year. Ping An Cloud automatically deletes these logs after one year is reached. To save logs on the storage devices of Ping An Cloud for a longer time, submit a <a class="xref" href="/console/workorder/create" target="_blank">Ticket</a>. </li> <li class="li"><strong class="ph b">No</strong>—Log files are not archived. The system automatically deletes the log data when its retention period expires.</li> </ul> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1 "> <p class="p">Use For Groups</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2 "> <p class="p">Select the host group to which the collection policy is applied.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1 "> <p class="p">Nginx Log Format </p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2 "> <p class="p">Format of the Nginx access logs to be collected. </p> <p class="p">The general Nginx access log format is provided by default. Log Service provides a dozen of frequently-used visualized charts to improve analysis and monitoring efficiency of Nginx applications based on the query and analysis of the collection status and information. </p> <div class="note note note_note"><span class="note__title">Note:</span> <ul class="ul" id="Create_Nginx_Strategy__ul_ek3_4ll_wnb"> <li class="li">You can update the format to the format actually configured. </li> <li class="li">This format must be consistent with your customized Nginx access log format. </li> </ul> </div> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__1 "> <p class="p">Nginx Key</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_tmm_ctz_wmb__entry__2 "> <p class="p">A list of fields that are automatically parsed based on the Nginx log format. The system extracts the log data based on these fields. The list is not editable. For more information, see the table below.</p> </td> </tr> </tbody></table> <p class="p"><span class="ph uicontrol">Details of Nginx Log Format</span></p> <table class="table" id="Create_Nginx_Strategy__table_u1n_qtz_wmb"><caption></caption><colgroup><col><col></colgroup><thead class="thead"> <tr class="row"> <th class="entry" id="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1">Parameter</th> <th class="entry" id="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2">Description</th> </tr> </thead><tbody class="tbody"> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">remote_addr</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Address of the client that visited the website.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">remote_user</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Name of the user who visited the website. </p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">time_local</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Time the website was visited and time zone. </p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">request</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Start line information of the user HTTP request.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">status</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">HTTP status code returned for the HTTP request, such as 200 or 404.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">body_bytes_sent</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Number of bytes in the response body that was sent by the Nginx server to the client.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">http_referer</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Link from which the request was sent.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">http_user_agent</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Access information of the client, such as the browser and smartphone client.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">http_x_forwarded_for</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">If you use a proxy server when visiting the website, you must configure the web node to record the client address.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">request_time</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Time of period (in seconds) for processing the client request, accurate to milliseconds. The time starts when the Nginx server receives the first character from the client and ends when the last character is sent to the client and the Nginx server finishes writing the log.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">upstream_response_time</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Time for the upstream server to respond to the request.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">upstream_addr</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Address of the upstream server.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">upstream_status</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Response status returned by the upstream server.</p> </td> </tr> <tr class="row"> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__1 "> <p class="p">request_length</p> </td> <td class="entry" headers="Create_Nginx_Strategy__table_u1n_qtz_wmb__entry__2 "> <p class="p">Request length of the client, in bytes. The request includes the addresses, HTTP request header, and request body.</p> </td> </tr> </tbody></table> </div> </li><li class="li step stepexpand"> <span class="ph cmd"> Click <strong class="ph b">Confirm</strong>.</span> </li></ol></section> <section class="section result" id="Create_Nginx_Strategy__result_ogm_5tz_wmb"><div class="tasklabel"><h2 class="doc-tairway">Results</h2></div> <p class="p">The new Nginx collection policy is displayed on the <strong class="ph b">AGENT CONFIG</strong> tab.</p> </section> <section class="section postreq" id="Create_Nginx_Strategy__postreq_fs2_ytz_wmb"><div class="tasklabel"><h2 class="doc-tairway">What to do next</h2></div> <p class="p">After collecting Nginx logs for a period of time, you can view the reports on a <a class="xref" href="/console/logcloud/dashboard/list" target="_blank">Dashboard</a>. For more information, see <a class="xref" href="/ssr/help/middleware/LogCloud/User_Guide.Visualization.Dashboard" target="_blank">Visualization</a>. </p> </section>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products