In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what is the use of log files in the logs directory in apache?" in the operation of actual cases, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
one。 Log analysis
If apache is installed with the default configuration, two files, access_log and error_log, will be generated in the / logs directory
1) .access_log
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.
218.19.140.242 / / the client side of the request to the apache server ip--[10/Dec/2010:09:31:17 + 0800] / / records the time of the request, and the last + 0800 indicates that the server is in the time zone of "GET / query/trendxml/district/todayreturn/month/2009-12-14 09/haizhu_tianhe.xml HTTP/1.1" / / the server received a GET request, followed by Is the resource path requested by the client. Third, when the protocol used by the client is HTTP/1.1, the whole format is "% m% U% Q% H", that is, "request method / access path / protocol" 200 / / status code 1933 / / indicates how many bytes the server sent to the client "-" Mozilla/5.0 (Windows) U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729) "/ / browser information of the client
2). Error_log
Error_log is an error log, which records any error processing requests. Its location and content are controlled by ErrorLog instructions. Usually, what errors occur on the server, it is the most important log file to consult it first.
[Fri Dec 10 15:03:59 2010] [error] [client 218.19.140.242] File does not exist: / home/htmlfile/tradedata/favicon.ico
two。 Practical log analysis commands and scripts
After understanding the various definitions of logs, here are some scripts for log analysis found on the Internet.
1. Check the number of processes in apache
Ps-aux | grep httpd | wc-l
two。 Analyze the log to see the number of ip connections of the day
Cat default-access_log | grep "10/Dec/2010" | awk'{print $2}'| sort | uniq-c | sort-nr
3. See what url the specified ip visited on the same day
Cat default-access_log | grep "10/Dec/2010" | grep "218.19.140.242" | awk'{print $7}'| sort | uniq-c | sort-nr
4. Check the url that visited the top 10 of the day
Cat default-access_log | grep "10/Dec/2010" | awk'{print $7}'| sort | uniq-c | sort-nr | head-n 10
5. To see what the specified ip did.
Cat default-access_log | grep 218.19.140.242 | awk'{print $1 "\ t" $8}'| sort | uniq-c | sort-nr | less
6. Check the minutes with the most visits (find hotspots)
Awk'{print $4} 'default-access_log | cut-c 14-18 | sort | uniq-c | sort-nr | head
This is the end of the content of "what is the use of log files in the logs directory in apache"? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.