How to , and other stuff about linux, photo, php … Another blog just like others on internet

January 23, 2015

Unique visitors from apache log file

Filed under: Linux — Tags: , , — admin @ 11:32 am

Well if you ever want to find out from apache log how many unique visitors you have here is one command

cat /usr/local/apache/domlogs/domain.log |awk '{print $1}' | sort | uniq | wc -l

If you want to find out for a date
cat /usr/local/apache/domlogs/domain.log | grep "\[05/Sep/2010" |awk '{print $1}' | sort | uniq | wc -l

Unique referrers
cat /usr/local/apache/domlogs/domain.log | awk '{print $11};' | awk -F / '{print $3}' | sort | uniq

Number of hits
cat /usr/local/apache/domlogs/domain.log | wc -l

Powered by WordPress