Added user count with ipv4 or ipv6

This commit is contained in:
Didier Clermonté 2019-09-18 23:03:33 +02:00 committed by root
parent 51b27b6b73
commit 88c62dc13d

View File

@ -68,12 +68,17 @@ generateReport()
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';" ) 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"
ipTotalCount=$(zgrep -h "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|cut -d' ' -f1|sort|uniq |wc -l) 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'ip visiteuses = $ipTotalCount" echo "Nombre d'ipv4 ayant visité le service = $ipv4Count"
ipUtilCount=$(zgrep -h "$monthEnglish" /var/log/apache2/date.chapril.org/date.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|grep -v "GET /fonts/"|grep -v "GET \(/css/\|/images/\|/ \)"|grep -v "GET /js/"|grep -v "HTTP/1.0\" 404"|cut -d' ' -f1|sort|uniq| wc -l ) 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'ip utilisatrices = $ipUtilCount" echo "Nombre d'ipv6 ayant visité le service = $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"
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 -e "\n" echo -e "\n"
} }