日志分析

1.找出超出3个产品的3A日志

 cat aaa.2011-0* |grep ServiceAuthReturn |grep result=1036|awk -F { '{print $2}'|awk -F ,prometion '{print $1}'|awk -F ,Product '{if($3 != null)print $3}' 

2.查看连接本机网络的各个IP
 netstat|awk '{if($1=="tcp") print $5}'|awk -F ':' '{hit[$1]++}END{for(i in hit){print i,hit[i]}}' 


3.这行命令用来分析netstat的输出结果,最后得出的是目前处于连接中的不同的IP地址
netstat -atn | cut -b 49-75 | grep -o -P "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b" | sort | uniq -c | sort -n -r -k 1,7 | head -10


4.这个命令是对于100个包中有多少个新连接请求的统计
time tcpdump -ns 200 -c 100 '(dst port http or dst port https) and tcp[13] & 2!=0' | grep -o -P '\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,5}\s\>' | cut -d '.' -f 1-4 | sort | uniq -c | sort -n -r -k 1,7 | head -25

5
netstat -n|awk '/^tcp/{++S[$NF]} END {for(a in S) print a,S[a]}' 

猜你喜欢

转载自13594135.iteye.com/blog/925026