Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function of Apache's Access Log?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge points about the role of Apache Access Log. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Access_log is an access log, which records all requests for access to the apache server. Its location and content are controlled by CustomLog instructions, and LogFormat instructions can be used to simplify the content and format of the log.

Access log

You will see many of the following access logs in Apache's Access Log:

127.0.0.1-[05/May/2011:10:54:07 + 0800] "OPTIONS * HTTP/1.0" 200-127.0.0.1-- [05/May/2011:10:54:08 + 0800] "OPTIONS * HTTP/1.0" 200-127.0.0.1-- [05/May/2011:10:54:09 + 0800] "OPTIONS * HTTP/1.0" 200-127.0.0.1- -[05/May/2011:10:54:10 + 0800] "OPTIONS * HTTP/1.0" 200-

What does this mean?

Description of the documentation for Apache

The documentation for Apache has the following instructions:

When the Apache HTTP Server manages its child processes, it needs a way to wake up processes that are listening for new connections. To do this, it sends a simple HTTP request back to itself. This request will appear in the access_log file with the remote address set to the loop-back interface (typically 127.0.0.1 or:: 1 if IPv6 is configured). If you log the User-Agent string (as in the combined log format), you will see the server signature followed by "(internal dummy connection)" on non-SSL servers. During certain periods you may see up to one such request for each httpd child process.

But why wake up? What is awakening for?

In Apache Prefork mode, when starting, Apache will fork some worker processes to prepare to accept the request. These worker processes, after completing the preparation work, will go into a deep sleep in block mode and wait for the request to arrive and be awakened.

On the other hand, in Prefork mode, when there are too many requests and the current number of worker processes is insufficient, it will fork some additional worker processes to meet the current requests.

After the peak of these requests, if the number of processes coming out of the additional fork is greater than MaxSpareServers, Apache will tell these worker processes to exit, then the problem arises.

These processes are in a deep sleep, ah, how to tell them, and let them quit?

Self-quitting

Apache will first send an exit status word (GRACEFUL_CHAR!) Give these Work processes:

Static apr_status_t pod_signal_internal (ap_pod_t * pod) {apr_status_t rv; char char_of_death ='!'; apr_size_t one = 1; rv = apr_file_write (pod- > pod_out, & char_of_death, & one) If (rv! = APR_SUCCESS) {ap_log_error (APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, write pipe_of_death);}. Return rv;}

But at this point, the Worker process does not read these status words because they are still asleep.

At this point, Apache will send itself an OPTIONS request to wake up these sleeping processes:

Static apr_status_t dummy_connection (ap_pod_t * pod) {/ /. There is an omission / * Create the request string. We include a User-Agent so that * adminstrators can track down the cause of the odd-looking * requests in their logs. * / srequest = apr_pstrcat (p, "OPTIONS * HTTP/1.0\ r\ nUser-Agent:", ap_get_server_banner (), "(internal dummy connection)\ r\ n\ n", NULL); / /. Have ellipsis}

After these processes have processed the current request (the OPTIONS request), they will find that the oh, the main process, told me to exit.

Static void child_main (int child_num_arg) {/ /... While (! die_now & &! shutdown_pending) {/ / is omitted. Omitted / / 1. Listen / 2. Accept / / 3. Process request / * Check the pod and the generation number after processing a * connection so that we'll go away if a graceful restart occurred * while we were processing the connection or we are the lucky * idle server process that gets to die. * / if (ap_mpm_pod_check (pod) = = APR_SUCCESS) {/ * selected as idle? * / die_now = 1;} / /. There is omission} / /. There is an omission} above is all the content of this article "what is the function of Apache's Access Log". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report