-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix perl regex to calculate download traffic per day correctly on GHE 2.12.x #107
Conversation
fix perl regex to extract the audit stats
updater/scripts/git-download.sh
Outdated
@@ -20,15 +20,20 @@ if ghe_greater_equal "2.11.0" ; then | |||
# most recent log files (because the information from yesterday may or not | |||
# be rotated already). | |||
CAT_LOG_FILE="zcat -f /var/log/github-audit.{log.1*,log} | grep -F '$(date --date='yesterday' +'%b %_d')'" | |||
|
|||
# The order in github-audit.log in GHE 2.12.x has been changed, to pick the right order PERL_REGEX is created. | |||
PERL_REGEX='print if s/.*"cloning":([^,]+).*"program":"upload-pack".*"repo_name":"([^"]+).*"uploaded_bytes":([^,]+).*"user_login":"([^"]+).*/\2\t\4\t\1\t\3/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that use the new regex for 2.11, too? The function above checks for greater_equal
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, then I recommend separating the version check for perl regex and the log file into 2 different ifs.
separate if for PERL_REGEX checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@larsxschneider do you think this way we could cover the concern?
Sorry @rashamalek for the delay. Thanks a lot for this fix 👍 - this is awesome 🎉 ! I reformatted your patch a bit and squashed it as 1e2e268 ! |
👍 |
I just realized that you don't show up in the contributors graph. If think you need to add your zalando email address to your github profile to make this work because I squashed the commits and didn't merge the PR directly. Sorry! |
No Worries :), I added the email. |
@rashamalek: And thanks for spotting this and submitting the fix 😄! |
this is tested on GHE 2.12.3, and covers: #98
Please test it on GHE 2.11.x if you have any running instance.