In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Log introduction
Nginx has two kinds of logs, one is the access log and the other is the error log.
All requests from the client to the server are recorded in the access log.
The error log records error messages that occur for some reason during access.
2. Access log and error log
(1) error log
Error_log path level
The format of the error log cannot be defined. You need to write down the path where the error log is stored, either relative or absolute.
The second parameter is the level of the log. The general level is debug | info | notice | warm | error | crit | alert | emerg. It is generally configured as error.
It is generally configured in the main,http,server,location; module.
When starting nginx, the directory path of the log will not be created automatically. You need to create all the directories so that nginx can start successfully, otherwise the directory path will not be found, and the log file itself is automatically created by nginx.
When you report a 500 error when visiting a web page, you can find out the reason under this log, whether any file does not have permissions, or is missing, and so on.
So it is necessary to configure this file in either the test environment or the production environment.
(2) access log
Log_format name format
The above is to configure the format of the access log. The purpose of this is to configure the fields that need to be counted in practice. It is not necessary to count all the fields.
You can define the name field by yourself, either mainlog or mylog, but multiple name cannot be duplicated.
Format is the log format, as long as you write down the fields you need.
The following is the type of field, you can choose the one you want to fill in.
Parameters.
Description
$remote_addr
Client address
$remote_user
Client user name
$time_local
Access time and time zone
$request
Requested URI and HTTP protocols
$http_host
Request address
$status
HTTP request status
$upstream_status
Upstream statu
$body_bytes_sent
File content size sent to client
$http_referer
Url jump source
$http_user_agent
Browser information
$ssl_protocol
SSL protocol version
$ssl_cipher
Algorithms in exchanging data
$upstream_addr
The address of the backend upstream, that is, the address of the host that actually provides the service
$request_time
The total time of the entire request
$upstream_response_time
Upstream response time during the request
Example:
Format
Log_format main'$remote_addr-$remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent"$http_x_forwarded_for"'
A certain access
192.168.0.137-[02/Apr/2019:11:52:46 + 0800] "GET / admin/index.php?act=common&op=pending_matters HTTP/1.1" 200 401 "http://192.168.0.133/admin/index.php"" Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36 ""-"
Access_log path format [buffer=sieze]
Access logs are not necessarily required. Configure according to your actual situation.
Path is a path, either a relative path or an absolute path.
Format is the format of the access log configured above. You only need to write the name of format.
You can write buffer or not. You can write buffer=16k if you need to configure it.
When starting nginx, the directory path of the log will not be created automatically. You need to create all the directories so that nginx can start successfully, otherwise the directory path will not be found, and the log file itself is automatically created by nginx.
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.