Нужна программа для анализа логов Apache [закрыто]

У меня есть grep логи Apache моего сайта за определенный период времени. Мне нужно программное обеспечение для анализа этого, чтобы увидеть, каковы наиболее посещаемые IP.

Моя ОС - Ubuntu.

Не могли бы вы посоветовать что-нибудь?

Спасибо.

-3
задан 2 April 2012 в 08:33
2 ответа

There are a number of logfile analyzer packages that exist - two of which are Webalizer (written in C) and AWStats (written in Perl). Both should also be available through the Ubuntu repositories. These will parse your logfiles and generate reports for you to view (typically through a web browser, although, they can generate text reports as well).

Traditionally, they are setup to run automatically (e.g. via cron) and the latest report is available by accessing a particular path under your domain, and/or is emailed to you. (As you may expect, both do require some setup to produce what you want).

If you just want get a list of which IP addresses have made the most requests, a one-time bash command is likely easier than setting up either of the above. Try:

awk '{!a[$1]++}END{for(i in a) if ( a[i] >10 ) print a[i],i }' access.log | sort -n -r

Essentially, create an array using the IP address as the index, increasing the counter with each match - and display those results with more than 10 matches. Pipe the result through sort to display in descending order.

If you have already used grep to filter your list, you can pipe the output of your that command through (a slight variation of) the one above.

For instance, for a list of IP addresses that made more than 10 requests, today, between midnight and 4am (not inclusive) (presuming that data is in access.log):

grep '02/Apr/2012:0[0-3]' access.log | awk '{!a[$1]++}END{for(i in a) if ( a[i] >10 ) print a[i],i }' | sort -n -r

Sample output:

40 66.xxx.xx.xx
35 184.xx.xxx.xx
26 147.xx.xxx.xx
18 74.xxx.xx.xxx
17 209.xx.xxx.xxx
15 14.xxx.xxx.xx
5
ответ дан 5 December 2019 в 21:51

Если вам интересно, ManageEngine предлагает решение под названием EventLog Analyzer. Он будет анализировать журналы веб-сервера Apache и генерировать исчерпывающие отчеты. Вы можете попробовать.

0
ответ дан 5 December 2019 в 21:51

Теги

Похожие вопросы