Created
May 23, 2012 09:59
-
-
Save loisaidasam/2774350 to your computer and use it in GitHub Desktop.
One liner for counting unique IP addresses from nginx logs
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
# One liner for counting unique IP addresses from nginx logs | |
# Feel free to comment with better ideas - I'm sure it's not the best way of doing this (I'm no awk ninja!) | |
# | |
# Sample output: | |
# | |
# $ cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' | |
# 66.65.145.220 49 | |
# 92.63.28.68 126 | |
cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' |
@Fazel94 hell yes
awk '{print $1 " " $3 " " $4}' access.log| sort | uniq -c | sort -nr
will give you the time frame
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have log file, sized 1.7 GB,
does these solutions work for that???