In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "Nginx access log example analysis", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Nginx access log example analysis" bar!
Data access Wizard (Wizard)
one。 Overview
Log service launched the data access Wizard (Wizard) in December to quickly complete data collection, storage, analysis and offline delivery, reducing the threshold for users to use log service. The supported data sources and configurations are as follows:
two。 Usage guidelines
If you have not yet used the Ali Cloud log service, you can refer to the five-minute Quick start.
Let's start with the most common NGINX access log analysis and try how to quickly access this type of data source.
First, you can enter the data access wizard in the following two ways.
To create a new project, click the data access wizard after creating the project and log library
Logstore already exists. Click the data access wizard icon in the list to enter.
1. Select data type
Select self-built software > NGINX.
two。 Data source settings
a. Fill in the configuration name and log path according to the actual situation, and enter the actual log_format information into the NGINX log format.
The log service automatically extracts the corresponding key name.
Note: where $request is extracted as the request_method and request_uri keys.
b. Apply to machine group
If you have not created a machine group before, follow the page prompts to create a machine group first.
Note: it takes up to 3 minutes for Logtail configuration push to take effect. Please wait patiently.
3. Query Analysis & Visualization
If the heartbeat of the log machine group is normal, you can obtain the collected data by clicking the preview button on the right.
CLS provides preset data key names for analysis and use. You can select the actual data key name (generated from the preview data) and the default data key name to form a mapping relationship. The preset data keys provided by the nginx access log are as follows:
Body_bytes_sent bytes_sent connection connection_requests msec status time_iso8601 time_local content_length content_type host hostname remote_addr remote_port remote_user request_length request_method request_time upstream_response_time request_uri scheme server_addr server_name server_port server_protocol http_user_agent http_referer
For the definition of each data key, please refer to the relevant NGINX documentation.
Click next, and the logging service will set the index properties for you and create a nginx-dashboard dashboard for analysis.
3.1 analyze access Log
Once we have established the dashboard, we can quickly analyze the access log and enter the analysis page through the left navigation dashboard.
PV/UV Statistics (pv_uv)
Count the number of PV and UV in the last day.
Statistical statement:
| | select approx_distinct (remote_addr) as uv, count (1) as pv, date_format (date_trunc ('hour', _ _ time__),'% MMI% d% HGV% i') as time group by date_format (date_trunc ('hour', _ time__),'% MMI% d% HGV% i') order by time limit 1000 |
Hotspot visit page statistics (top_page)
Count the top 20 pages visited in the last day.
Statistical statement:
* | select count (1) as pv, split_part (request_uri,'?',1) as path group by split_part (request_uri,'?',1) order by pv desc limit 20
Request method Statistics (http_method_percentage)
Count the proportion of various request methods in the last day.
Statistical statement:
* | select count (1) as pv, request_method group by request_method
Http status Code Statistics (http_status_percentage)
Count the proportion of all kinds of http status codes in the last day.
Statistical statement:
* | select count (1) as pv, status group by status
Client Type Statistics (user_agent)
Count the proportion of various browsers in the last day.
Statistical statement:
* | select count (1) as pv, case when http_user_agent like'% Android%' then 'Android' when http_user_agent like'% iPhone%' then 'iOS' else' unKnown' end as http_user_agent group by case when http_user_agent like'% Android%' then 'Android' when http_user_agent like'% iPhone%' then 'iOS' else' unKnown' end order by pv desc limit 10
Source Page Statistics (top_10_referer)
Count the proportion of the top ten referer originating from different domain names in the last day.
Statistical statement:
* | select count (1) as pv, http_referer group by http_referer order by pv desc
4. Delivery & ETL
In addition, delivery services are also provided to MaxCompute (formerly ODPS), OSS and ETL. Interested students can refer to the corresponding help links.
At this point, I believe you have a deeper understanding of "Nginx access log example analysis". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.