Linux server load, process and other information can be viewed through the top command. And how does Apache behave in real-time? "Tail-f" log file? It's a good way, but it's too tired!
So, thank Chris Elsworth for providing us with a apachetop command like the top command! Website address: http://www.webta.org/projects/apachetop/
Apachetop can view the most recent time and Apache access since the command was executed, including the files accessed, the number of times, and the size of the traffic.
command installation, use can view the instructions provided by the official website: Http://www.webta.org/projects/apachetop/browser/README, or see a Chinese explanation: "Real-time tracking log changes in the tool apachetop."
Here I explain the command display information and some useful parameters.
First look at the command display:
The following is a reference fragment:
Last hit:11:19:12 atop runtime: 0 days, 07:12:27 11:19:13 all: 1553476 reqs ( 59.9/sec) 3566.4M ( 140.7k/sec) 2407.3b/req 2xx:1458916 (93.9%) 3xx: 93768 (6%) 4xx: 787 (0.1%) 5xx: 5 (0.0%) R (30s): 1692 reqs ( 56.4/sec) 4342.8K ( 144.8k/sec) 2628.3b/req 2xx: 1606 (94.9%) 3xx: 85 (5%) 4xx: 1 (0.1%) 5xx: 0 (0.0%) Reqs req/s KB kb/s URL 916 30.53 1202 40.1*/api/chk.php 2.37 433.7 14.5/login.php 1.67 44.6 1.5/css/css.css 1.50 506.4 19.5/js/js.js |
The "Last Hit:11:19:12" and "11:19:13" in the first line show the final observation time, and the current time, respectively, for this display. But I do not understand this time, because the world and the system of time is inconsistent. I do not know whether I understand the wrong or what happened, forget the informed friend message told me.
The middle part of the first line indicates how long this command has been running.
Line second to third shows all the data summaries that have been observed since the command was executed. Line fourth to fifth shows a summary of the data for nearly 30 tables. The previous line represents the total number of requests, the number of requests processed per second, the total amount of data transferred, and the amount of data transferred per request. The following line shows the HTTP response type, the total number of this type, and the number of responses of this type per second. This is still very well understood.
The next data is the size of the traffic from which programs are accessed. The format is also very well understood.
There are several useful parameter values to learn about.
-F: This parameter specifies the object that the Apachetop command observes. Not everyone's Apache logs are in the default location, and even you can use multiple log files to distinguish between different ports (80, 443), correct and incorrect access logs, and so on for statistical convenience. You can use this parameter to specify the log file at this time. In particular, you may need to view multiple logs at the same time, you can use the-f parameter multiple times, such as: Apachetop-f file1-f file2.
-D: By default, the display interface refreshes every 5 seconds, and you can use this parameter to make changes if you feel uncomfortable with the refresh rate.
-T: In the example above, we saw in the last 30 seconds what was happening. If you feel that the density is not enough, you can use this parameter to make changes.
H: Or the above example, you can see that the total number of requests for the last 30 seconds is: 1606+85+1+0=1692 times. What if you want to refresh the interface for every request n times? Ha, this is the command!
Note: the-T and-H parameters cannot be used at the same time, otherwise you will be prompted: "-t and-h is mutually exclusive. Specify only one. "
-Q: There are programs that can be used with parameters, that is, get mode. If you want to see what the parameters are, you can use this command!
Real-time view of Apache access tools Apachetop