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)06/03 Report--
How do I enable Apache server logging? To solve this problem, the editor summarizes this article about Apache server today, hoping to help more students who want to use Apache server to record logs to find a more simple and easy way.
The Apache server log provides details to help detect common problems with the server. To log access to a Web site, mod_log_configmodule must be enabled.
There are three directives in the apache configuration file, namely-
TransferLog: create a log file.
LogFormat: specifies a custom format.
CustomLog: create and format log files.
The TransferLog directive is available in the apache configuration file, which rotates the virtual host log file based on the setting parameters.
VirtualHost www.example.com >
ServerAdmin webmaster@yiibai.com
DocumentRoot / usr/www/example/httpd/htdocs/
ServerName www.example.com
ServerAlias example.com www.example
ErrorLog / usr/www/example/httpd/logs/error_log
TransferLog / usr/www/example/httpd/logs/accesslog
CustomLog / usr/www/example/httpd/logs/accesslog combined
Two types of Apache log formats
General log format
Combined log format
You can enable them by editing apache configuration files, that is, apache2.conf (Debian/ubuntu) or httpd.conf (rpm-based system) files.
General log format
LogFormat "h% l% u% t\"% r\ "% > s% b" common
CustomLog logs/access_log.log common
An example of general log content generated by Apache is as follows
[Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] client denied by server configuration: / export/home/live/ap/htdocs/test
Combined log format
LogFormat "% h% l% u% t\"% r\ "% > s% b\"% {Referer} I\ "\"% {User-agent} I\ "" combined
CustomLog log/access_log.log combined
In the above format
H is a remote host
L is the identity of the user determined by identd
U is the user name determined by HTTP authentication
T is the time that the server finished processing the request.
% r is the request line ("GET/HTTP/1.0") from the client.
% > s is the status code sent from the server to the client (500404, etc.)
% b is the size of the client response (in bytes) Referer is the page linked to this URL.
The user agent is the browser identity string.
Combination logs generated by Apache:
199.180.11.91-[06/Mar/2019:04:22:58 + 0100] "GET / robots.txt HTTP/1.1" 404 1228 "-" Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) "
Custom logs create separate log files for each virtual host on the server. It needs to be specified in the virtual hosts section of the configuration file.
You can see the virtual host configuration mentioned below, and the generated logs will be customized for that virtual host and will be combined.
After reading the above, have you mastered the method of enabling Apache server to log? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.