Improved statistics on ip (#3807)

This commit is contained in:
Didier Clermonté 2019-10-01 16:26:15 +02:00 committed by root
parent 56655537ad
commit 66ad2e26db

View File

@ -1,4 +1,3 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (C) 2018, 2019 Didier Clermonté <dclermonte@april.org> # Copyright (C) 2018, 2019 Didier Clermonté <dclermonte@april.org>
@ -40,10 +39,10 @@ generateReport()
httpRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep $year|wc -l) httpRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep $year|wc -l)
echo "Nombre total de requêtes http = $httpRequestCount" echo "Nombre total de requêtes http = $httpRequestCount"
trueHttpRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep $year|grep -vi bot|grep -v check|wc -l) trueHttpRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep $year|grep -vi bot|grep -v check_http|wc -l)
echo "Nombre de vraies requêtes http = $trueHttpRequestCount" echo "Nombre de vraies requêtes http = $trueHttpRequestCount"
botRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep "$year"|grep -i bot|grep -c -v check) botRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep "$year"|grep -i bot|grep -c -v check_http)
echo "Nombre de requêtes bot = $botRequestCount" echo "Nombre de requêtes bot = $botRequestCount"
errorsRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-error.log*|grep -c "$year") errorsRequestCount=$(zgrep "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-error.log*|grep -c "$year")
@ -71,12 +70,16 @@ generateReport()
ipv6Count=$(zgrep -h "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.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 ) ipv6Count=$(zgrep -h "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.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/paste.chapril.org/paste.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|grep '^\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\} '|grep POST|cut -d' ' -f 1|sort|uniq|wc -l ) ipv4UserCount=$(zgrep -h "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep "$year"|grep -vi bot|grep -v check_http|grep '^\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\} '|grep POST|cut -d' ' -f 1|sort|uniq|wc -l )
echo "Nombre d'ipv4 utilisatrices du service = $ipv4UserCount" echo "Nombre d'ipv4 utilisatrices du service = $ipv4UserCount"
ipv6UserCount=$(zgrep -h "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep "$year"|grep -vi bot|gre\p -v check_http|grep '^\([0-9a-f]\{0,4\}:\)\{2,7\}\([0-9a-f]\{0,4\}\)\{1\} '|grep POST|cut -d' ' -f 1|sort|uniq|wc -l ) ipv6UserCount=$(zgrep -h "$monthEnglish" /var/log/apache2/paste.chapril.org/paste.chapril.org-access.log*|grep "$year"|grep -vi bot|gre\p -v check_http|grep '^\([0-9a-f]\{0,4\}:\)\{2,7\}\([0-9a-f]\{0,4\}\)\{1\} '|grep POST|cut -d' ' -f 1|sort|uniq|wc -l )
echo "Nombre d'ipv6 utilisatrices du service = $ipv6UserCount" echo "Nombre d'ipv6 utilisatrices du service = $ipv6UserCount"
echo "Nombre total d'ip utilisatrices du service = $((ipv4UserCount+ipv6UserCount))"
echo -e "\n" echo -e "\n"