squid ログがあり、2 つの異なる IP からログインしているユーザーを見つける必要があります (パスワードが侵害されている可能性があります)。
ログから 3 つの情報 (ユーザー、時間、IP) を抽出し、別のファイルに保存しました
1110104 1397367240.280 172.27.71.14
1110104 1397367242.439 172.27.71.14
1110104 1397367245.805 172.27.71.14
1110104 1397367246.120 172.27.71.14
1110104 1397367249.770 172.27.71.14
1110104 1397367255.125 172.27.71.14
1110104 1397367255.503 172.27.71.13
1110104 1397367257.255 172.27.71.13
1110104 1397367257.596 172.27.71.13
1110104 1397367257.956 172.27.71.14
1110104 1397367258.353 172.27.71.14
1110104 1397367258.698 172.27.71.14
1110104 1397367259.079 172.27.71.14
1110104 1397367260.879 172.27.71.14
1110104 1397367260.880 172.27.71.14
1110104 1397367261.250 172.27.71.14
1110104 1397367261.254 172.27.71.14
1110104 1397367264.594 172.27.71.13
1110104 1397367264.620 172.27.71.13
1110104 1397367264.948 172.27.71.14
1110104 1397367264.960 172.27.71.14
1110104 1397367265.331 172.27.71.14
1110104 1397367265.340 172.27.71.14
1110104 1397367265.710 172.27.71.14
1110104 1397367266.072 172.27.71.14
1110104 1397367266.157 172.27.71.14
1110104 1397367266.420 172.27.71.14
このような行が何百万もあるので、私のアプローチには何時間もかかります
firstLine=`cat data.log | head -1`
user1=`echo $firstLine | cut -d " " -f1`
time1=`echo $firstLine | cut -d " " -f2 | cut -d "." -f1`
ip1=`echo $firstLine | cut -d " " -f3`
while read -r line; do
user2=`echo $line | cut -d " " -f1`
time2=`echo $line | cut -d " " -f2 | cut -d "." -f1`
ip2=`echo $line | cut -d " " -f3`
if [ "$user1" = "$user2" ] && [ "$ip1" != "$ip2" ] && [ $(($time2-$time1)) -lt 600] # time diff is lass than 10 minutes
then
echo "user "$user1
echo "at "`date -d @$time1` " using "$ip1 " and after "$(($time2-$time1))" seconds using "$ip2
elif [ "$user1" != "$user2" ]
then
a1=$a2
b1=$b2
c1=$c2
fi
done < data.log
処理後、別のIPからログインしているユーザーとしての情報が必要です。
user 1110104
at jan 18 12:33:12 (full date time).... using 172.27.71.14 and after 5 seconds using 172.27.71.13
つまり、2 人の人物が 2 つの異なる IP からまったく同じユーザー名とパスワードを使用していることを意味します。
質問がより明確になることを願っています。