Difference between revisions of "View Domlogs for top visitors"
(→SuPHP Version) |
(→Script) |
||
| Line 3: | Line 3: | ||
==Script== | ==Script== | ||
| − | === | + | ===Standard=== |
<code>[bash,n]echo "Date String [31/Mar/2011:13:4]"; read datestring; \ | <code>[bash,n]echo "Date String [31/Mar/2011:13:4]"; read datestring; \ | ||
| + | for i in $(grep $datestring /usr/local/apache/domlogs/* | awk {'print $1'} | sort | uniq -c | sort -n | sed -e 's/^[ \t]*//' | awk '{print $1 ":" $2}' | tail -10); \ | ||
| + | do count=`echo $i | cut -d: -f1`; \ | ||
| + | ip=`echo $i | cut -d: -f3`; \ | ||
| + | domain=`echo $i | cut -d: -f2`; \ | ||
| + | agent=`grep $datestring $domain | grep $ip | cut -d '"' -f6 | sort | uniq -c | sort -n | awk {'print "\n\t" $0'}` ; \ | ||
| + | echo -e "$count $ip $domain $agent"; done </code> | ||
| + | |||
| + | ===Auto Date=== | ||
| + | <code>[bash,n] datestring=`date | awk '{print $3 "/" $2 "/" $6 ":" $4}' | sed 's/....$//'` \ | ||
| + | for i in $(grep $datestring /usr/local/apache/domlogs/* | awk {'print $1'} | sort | uniq -c | sort -n | sed -e 's/^[ \t]*//' | awk '{print $1 ":" $2}' | tail -10); \ | ||
| + | do count=`echo $i | cut -d: -f1`; \ | ||
| + | ip=`echo $i | cut -d: -f3`; \ | ||
| + | domain=`echo $i | cut -d: -f2`; \ | ||
| + | agent=`grep $datestring $domain | grep $ip | cut -d '"' -f6 | sort | uniq -c | sort -n | awk {'print "\n\t" $0'}` ; \ | ||
| + | echo -e "$count $ip $domain $agent"; done </code> | ||
| + | |||
| + | ===Auto Date (Minus 10m)===<code>[bash,n] datestring=`date -d "10 min ago" | awk '{print $3 "/" $2 "/" $6 ":" $4}' | sed 's/....$//'` \ | ||
for i in $(grep $datestring /usr/local/apache/domlogs/* | awk {'print $1'} | sort | uniq -c | sort -n | sed -e 's/^[ \t]*//' | awk '{print $1 ":" $2}' | tail -10); \ | for i in $(grep $datestring /usr/local/apache/domlogs/* | awk {'print $1'} | sort | uniq -c | sort -n | sed -e 's/^[ \t]*//' | awk '{print $1 ":" $2}' | tail -10); \ | ||
do count=`echo $i | cut -d: -f1`; \ | do count=`echo $i | cut -d: -f1`; \ | ||
Revision as of 13:45, 11 May 2011
Overview
Enter a partial date string to get top visitors during that period. Will also return site and all user agents that IP has used.
Script
Standard
[bash,n]echo "Date String [31/Mar/2011:13:4]"; read datestring; \
for i in $(grep $datestring /usr/local/apache/domlogs/* | awk {'print $1'} | sort | uniq -c | sort -n | sed -e 's/^[ \t]*//' | awk '{print $1 ":" $2}' | tail -10); \
do count=`echo $i | cut -d: -f1`; \
ip=`echo $i | cut -d: -f3`; \
domain=`echo $i | cut -d: -f2`; \
agent=`grep $datestring $domain | grep $ip | cut -d '"' -f6 | sort | uniq -c | sort -n | awk {'print "\n\t" $0'}` ; \
echo -e "$count $ip $domain $agent"; done
Auto Date
[bash,n] datestring=`date | awk '{print $3 "/" $2 "/" $6 ":" $4}' | sed 's/....$//'` \
for i in $(grep $datestring /usr/local/apache/domlogs/* | awk {'print $1'} | sort | uniq -c | sort -n | sed -e 's/^[ \t]*//' | awk '{print $1 ":" $2}' | tail -10); \
do count=`echo $i | cut -d: -f1`; \
ip=`echo $i | cut -d: -f3`; \
domain=`echo $i | cut -d: -f2`; \
agent=`grep $datestring $domain | grep $ip | cut -d '"' -f6 | sort | uniq -c | sort -n | awk {'print "\n\t" $0'}` ; \
echo -e "$count $ip $domain $agent"; done
===Auto Date (Minus 10m)===[bash,n] datestring=`date -d "10 min ago" | awk '{print $3 "/" $2 "/" $6 ":" $4}' | sed 's/....$//'` \
for i in $(grep $datestring /usr/local/apache/domlogs/* | awk {'print $1'} | sort | uniq -c | sort -n | sed -e 's/^[ \t]*//' | awk '{print $1 ":" $2}' | tail -10); \
do count=`echo $i | cut -d: -f1`; \
ip=`echo $i | cut -d: -f3`; \
domain=`echo $i | cut -d: -f2`; \
agent=`grep $datestring $domain | grep $ip | cut -d '"' -f6 | sort | uniq -c | sort -n | awk {'print "\n\t" $0'}` ; \
echo -e "$count $ip $domain $agent"; done