Created
December 23, 2015 18:55
-
-
Save nhoag/6d4dc33feb64c7c7fc29 to your computer and use it in GitHub Desktop.
Calculate bandwidth per minute from access log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat access.log \ | |
| awk -F' ' '{ | |
time = substr($4, 2, 17); | |
times[time] = time; | |
bandwidth[time] += $10 | |
} END { | |
for (t in times) print times[t],bandwidth[t]/1024/1024 | |
}' \ | |
| column -t \ | |
| sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment