Home >Backend Development >PHP Tutorial >[Log Analysis] Extract valid request uri from nginx log

[Log Analysis] Extract valid request uri from nginx log

WBOY
WBOYOriginal
2016-08-08 09:19:231190browse
Recently I am doing the company's nginx log analysis. One of the requirements is to extract the top 10 pages visited every day this month and the number of visits. To meet this requirement, you must first clear out valid page visits. I use the elimination method to remove access such as .js and .css. But initially, I didn't have a comprehensive understanding of the requests with which suffixes should be removed. After cleaning-> sampling-> cleaning-> sampling-> cleaning, it is finally necessary to filter out the uri containing the following suffix
.js .css .gif .jpeg .jpg .png .ico . txt .swf .xml .JPEG .PNG .JPG
#python代码:
if re.search(r"(\.js|\.css|\.gif|\.jpe?g|\.png|\.ico|\.txt|\.swf|\.JPE?G|\.PNG|\.xml)", request[1]):
        continue

There may be some special circumstances in the logs of different companies, which also require sampling and analysis

Copyright statement: This article is an original article by the blogger and has not been authorized Reprinting is not allowed with the permission of the blogger.

The above has introduced [Log Analysis] to extract the valid request uri from the nginx log, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php-object-oriented (5)Next article:php-object-oriented (5)