Shell Script

apache log – ip

1. 개요

apache access log를 확인하여 IP 출력

 

2. Source Code

#!/bin/sh
 
# find access ip to apache log
 
WEB_PATH="/var/log/apache2/access.log"
 
echo "=== check apache log ==="
echo -n "year : "
read inyear
echo -n "month : "
read inmonth
echo -n "day : "
read inday
 
indate=`LANG=C date '+%d/%b/%Y'  -d $inyear$inmonth$inday`
 
echo "indate : $indate"
 
echo -n " $inyear/$inmonth/$inday connect : "
 
grep "$time" "$WEB_PATH" | awk '{print $1}' | sort -u

 

 

Back To Top