Skip to content

Commit 2629f1e

Browse files
read Git client versions from audit log
Previously we read the versions from the haproxy log and used the originating IP address to distinguish machines/users. In a load balancer setup this IP address can be the same for all requests and consequently the number of users per version are not counted correctly. Fix this by using the audit log to count the Git versions. Also count the versions by user ID and not by IP address. see #184
1 parent 0fe15fd commit 2629f1e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

updater/scripts/git-versions.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#
55
echo -e "Git version\tusers"
66

7-
zgrep -hF '||git/' /var/log/haproxy.log.1* |
8-
perl -lape 's/.* (.*):.* \[.*\|\|git\/(\d+(?:\.\d+){0,2}).*/$1 $2/' |
7+
zcat -f /var/log/github-audit.log.1* |
8+
perl -ne 'print if s/.*agent=git\/(\d+(?:\.\d+){0,2}).*"user_id":(\d+).*/\2\t\1/' |
99
sort |
1010
uniq |
11-
perl -lape 's/[^ ]+ //' |
11+
perl -lape 's/\d+ *//' |
1212
sort -r -V |
1313
uniq -ic |
1414
awk '{printf("%s\t%s\n",$2,$1)}'

0 commit comments

Comments
 (0)