Improved statistics on ip (#3332)

This commit is contained in:
Didier Clermonté 2019-10-01 16:56:10 +02:00 committed by root
parent 88c62dc13d
commit 415637f4f8

View File

@ -36,49 +36,54 @@ generateReport()
echo -e "================================================================="
echo
creationCount=$(grep "CREATE_POLL" /var/www/date.chapril.org/admin/stdout.log | grep -c "$month")
echo "Nombre de sondages créés = $creationCount"
echo "Nombre de sondages créés = $creationCount"
mailCount=$(grep "CREATE_POLL" /var/www/date.chapril.org/admin/stdout.log | grep "$month"|cut -d',' -f5|sort|uniq|wc -l)
echo "Nombre d'adresses mail différentes = $mailCount"
echo "Nombre d'adresses mail différentes = $mailCount"
deletionCount=$(grep "DELETE_POLL" /var/www/date.chapril.org/admin/stdout.log | grep -c "$month")
echo "Nombre de sondages supprimés = $deletionCount"
echo "Nombre de sondages supprimés = $deletionCount"
pollCount=$(echo "SELECT count(*) from fd_poll;"| mysql --silent -u root date_chapril_org_db)
echo "Nombre total de sondages dans la base = $pollCount"
echo "Nombre total de sondages dans la base = $pollCount"
purgeCount=$(grep "EXPIRATION_SUCCESS" /var/www/date.chapril.org/admin/stdout.log | grep -c "$month")
echo "Nombre de sondages purgés = $purgeCount"
echo "Nombre de sondages purgés = $purgeCount"
pollExpiredCount=$(echo "SELECT count(*) from fd_poll where end_date > now();"| mysql --silent -u root date_chapril_org_db)
echo "Nombre de sondages expirés = $pollExpiredCount"
echo "Nombre de sondages expirés = $pollExpiredCount"
httpRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep -c "$year")
echo "Nombre total de requêtes http = $httpRequestCount"
echo "Nombre total de requêtes http = $httpRequestCount"
trueHttpRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -c -v check)
echo "Nombre de vraies requêtes http = $trueHttpRequestCount"
trueHttpRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -c -v check_http)
echo "Nombre de vraies requêtes http = $trueHttpRequestCount"
botRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -i bot|grep -c -v check)
echo "Nombre de requêtes bot = $botRequestCount"
botRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -i bot|grep -c -v check_http)
echo "Nombre de requêtes bot = $botRequestCount"
errorRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-error.log*|grep -c "$year")
echo "Nombre de requêtes http en erreur = $errorRequestCount"
echo "Nombre de requêtes http en erreur = $errorRequestCount"
databaseSize=$(mysql --silent -u root date_chapril_org_db -e "SELECT round(sum(data_length+index_length)/1024/1024,3) AS 'Size (MB)' FROM information_schema.tables WHERE table_schema='date_chapril_org_db';" )
echo "Taille de la base de données = $databaseSize MB"
echo "Taille de la base de données = $databaseSize MB"
ipv4Count=$(zgrep -h "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|grep '^\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\} '|cut -d' ' -f1|sort|uniq |wc -l)
echo "Nombre d'ipv4 ayant visité le service = $ipv4Count"
echo "Nombre d'ipv4 ayant visité le service = $ipv4Count"
ipv6Count=$(zgrep -h "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|grep '^\([0-9a-f]\{0,4\}:\)\{2,7\}\([0-9a-f]\{0,4\}\)\{1\} '|cut -d' ' -f1|sort|uniq |wc -l)
echo "Nombre d'ipv6 ayant visité le service = $ipv6Count"
echo "Nombre d'ipv6 ayant visité le service = $ipv6Count"
echo "Nombre total d'ip ayant visité le service = $((ipv4Count+ipv6Count))"
ipv4UserCount=$(zgrep -h "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|grep '^\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\} '|grep -v "GET \(/.git/|/img/|/i18n/|/js/|/fonts/|/css/\|/images/\| /\)"|grep -v "HTTP/1.0\" 404"|grep -v "HEAD"|grep -v "GET /"|cut -d' ' -f1|sort|uniq|wc -l )
echo "Nombre d'ipv4 utilisatrices = $ipv4UserCount"
echo "Nombre d'ipv4 utilisatrices = $ipv4UserCount"
ipv6UserCount=$(zgrep -h "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|grep '^\([0-9a-f]\{0,4\}:\)\{2,7\}\([0-9a-f]\{0,4\}\)\{1\} '|grep -v "::1 "|grep -v "GET \(/.git/|/img/|/i18n/|/js/|/fonts/|/css/\|/images/\| /\)"|grep -v "HTTP/1.0\" 404"|grep -v "HEAD"|grep -v "GET /"|cut -d' ' -f1|sort|uniq|wc -l )
echo "Nombre d'ipv6 utilisatrices = $ipv6UserCount"
echo "Nombre d'ipv6 utilisatrices = $ipv6UserCount"
echo "Nombre total d'ip ayant utilisées le service = $((ipv4UserCount+ipv6UserCount))"
echo -e "\n"
}