The Nginx log in the Linux system can view the system running records and error descriptions. The analysis of the Nginx logs can be used to understand the status of the system running. So how to analyze the Linux system Nginx log?
Nginx log configuration has two places: access_log and log_format.
Default format:
access_log /data/logs/nginx-access.log;
log_format old ‘$remote_addr [$time_local] $status $request_time $body_bytes_sent ’
‘“$request” “$http_referer” “$http_user_agent”’;
I believe most people who have used Nginx are configured for the default Nginx log format. Familiar, familiar with the contents of the log. However, the default configuration and format are readable, but difficult to calculate.
Nginx log brush related policy can be configured:
For example, set buffer, buffer full 32k to brush; if the buffer is not full 5s clock forced brush configuration is as follows:
access_log /data/logs/nginx-access.log buffer=32k flush=5s;
This determines whether the log is seen in real time and the impact of the log on disk IO.
A lot of variables that Nginx logs can log do not appear in the default configuration:
For example:
Request data size: $request_length
Return data Size: $bytes_sent
Request Time: $request_time
Connection Serial Number: $connection
Current Connection Requests: $connection_requests
Nginx The default format is uncalculated and you need to convert it to a computable format, such as splitting each field with the control character ^A (crox+v ctrl+a on Mac).
The format of log_format can be changed like this:
log_format new ‘$remote_addr^A$http_x_forwarded_for^A$host^A$time_local^A$status^A’
‘$request_time^A$request_length^A$bytes_sent^A$http_referer^A$request^A$http_user_agent’;
This is followed by a common Linux command line tool:
Find the most frequently visited URLs and times:
cat access.log
Using shell scripts under Linux can easily implement multi-threaded operations. Not only can shell s
Ncurses is a library. The most used component is a form. In the operation of Linux system, many frie
Regardless of whether it is on Windows or Linux, I believe that many users or developers have encoun
Since Linux does not support HiDPI devices very well, you need to set up the Linux desktop environme
How to modify the color of the Linux system shell script output text
How to use Linux to use rsync command to delete small files in batches
How to solve the shell script stop execution when the Linux system is scheduled?
Linux installation of the appropriate kernel header file method
What is the use of the Linux system pppsetup command?
How to create symbolic links for Linux systems
How to display the number of Linux subfolders and files
Using Linux routing and forwarding function to share the Internet
Linux system using the sl command to make train dynamic desktop skills
GDB function summary in Linux system
How to detect the hard disk is good or bad
Microsoft WP team blog said Mango system released on September 15
Win8.1 can not shut down the problem solution
Shut down SSD solid state hard drive index graphic tutorial under Win8
How to cancel the "quick access" function in win10 computer?
How to uninstall and reinstall Lenovo OneKey Recovery program in VISTA system?
What permissions do I need to join the domain?
Simple setup Effectively improve the speed and performance of the Win7 system