标签:new 命令 ack 状态 http ble watch log time
awk ‘{print $1}‘ log_file|sort|uniq|wc -l
grep "/index.php" log_file | wc -l
awk ‘{++S[$1]} END {for (a in S) print a,S[a]}‘ log_file > log.txt
sort -n -t ‘ ‘ -k 2 log.txt 配合sort进一步排序
awk ‘{++S[$1]} END {for (a in S) print S[a],a}‘ log_file | sort -n
grep ^111.111.111.111 log_file| awk ‘{print $1,$7}‘
awk ‘{print $12,$1}‘ log_file | grep ^"Mozilla | awk ‘{print $2}‘ |sort | uniq | wc -l
awk ‘{print $4,$1}‘ log_file | grep 16/Aug/2015:14 | awk ‘{print $2}‘| sort | uniq | wc -l
awk ‘{print $1}‘ |sort|uniq -c|sort -nr |head -10 access_log
cat log_file|awk ‘{print $11}‘|sort|uniq -c|sort -nr | head -10 cat log_file|awk ‘{print $11}‘|sort|uniq -c|sort -nr|head -20 awk ‘{print $1}‘ log_file |sort -n -r |uniq -c | sort -n -r | head -20
cat access.log |grep ‘04/Jun/2020‘| awk ‘{print $11}‘|sort|uniq -c|sort -nr|head -20
cat access_log | awk ‘($11~/www.abc.com/){print $1}‘|sort|uniq -c|sort -nr
cat linewow-access.log|awk ‘{print $1}‘|sort|uniq -c|sort -nr|head -10
awk ‘($9 ~/404/)‘ access.log | awk ‘{print $9,$7}‘ | sort
cat access.log |awk ‘{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}‘ cat access.log |awk ‘{print $9}‘|sort|uniq -c|sort -rn
cat apache.log |awk ‘{if($7~/GET/) count++}END{print "client_request="count}‘ cat apache.log |awk ‘{BYTE+=$11}END{print "client_kbyte_out="BYTE/1024"KB"}‘
cat /tmp/access.log | grep "20/Mar/2011" |awk ‘{print $3}‘|sort |uniq -c|sort -nr|head
cat access.log | grep "10.0.21.17" | awk ‘{print $8}‘ | sort | uniq -c | sort -nr | head -n 10
awk -vFS="[:]" ‘{gsub("-.*","",$1);num[$2" "$1]++}END{for(i in num)print i,num[i]}‘ log_file | sort -n -k 3 -r | head -10
awk ‘{print $1}‘ access.log | grep "20/Mar/2011" |cut -c 14-18|sort|uniq -c|sort -nr|head
netstat -nat |awk ‘{print $6}‘|sort|uniq -c|sort -rn netstat -n | awk ‘/^tcp/ {++S[$NF]};END {for(a in S) print a, S[a]}‘ netstat -n | awk ‘/^tcp/ {++state[$NF]}; END {for(key in state) print key,"",state[key]}‘ netstat -n | awk ‘/^tcp/ {++arr[$NF]};END {for(k in arr) print k,"",arr[k]}‘ netstat -n |awk ‘/^tcp/ {print $NF}‘|sort|uniq -c|sort -rn netstat -ant | awk ‘{print $NF}‘ | grep -v ‘[a-z]‘ | sort | uniq -c netstat -ant|awk ‘/ip:80/{split($5,ip,":");++S[ip[1]]}END{for (a in S) print S[a],a}‘ |sort -n netstat -ant|awk ‘/:80/{split($5,ip,":");++S[ip[1]]}END{for (a in S) print S[a],a}‘ |sort -rn|head -n 10 awk ‘BEGIN{printf ("http_codecount_num")}{COUNT[$10]++}END{for (a in COUNT) printf a""COUNT[a]""}‘
netstat -anlp|grep 80|grep tcp|awk ‘{print $5}‘|awk -F: ‘{print $1}‘|sort|uniq -c|sort -nr|head -n20 netstat -ant |awk ‘/:80/{split($5,ip,":");++A[ip[1]]}END{for(i in A) print A[i],i}‘ |sort -rn|head -n20
tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." ‘{print $1"."$2"."$3"."$4}‘ | sort | uniq -c | sort -nr |head -20
netstat -n|grep TIME_WAIT|awk ‘{print $5}‘|sort|uniq -c|sort -rn|head -n20
netstat -nat|grep ":80"|awk ‘{print $5}‘ |awk -F: ‘{print $1}‘ | sort| uniq -c|sort -n
netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}‘ watch "netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}‘" # 通过watch可以一直监控 LAST_ACK 5 #关闭一个TCP连接需要从两个方向上分别进行关闭,双方都是通过发送FIN来表示单方向数据的关闭,当通信双方发送了最后一个FIN的时候,发送方此时处于LAST_ACK状态,当发送方收到对方的确认(Fin的Ack确认)后才真正关闭整个TCP连接; SYN_RECV 30 # 表示正在等待处理的请求数; ESTABLISHED 1597 # 表示正常数据传输状态; FIN_WAIT1 51 # 表示server端主动要求关闭tcp连接; FIN_WAIT2 504 # 表示客户端中断连接; TIME_WAIT 1057 # 表示处理完毕,等待超时结束的请求数;
watch "awk ‘{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}‘ log_file|sort -k 2 -nr|head -n10"
标签:new 命令 ack 状态 http ble watch log time
原文地址:https://www.cnblogs.com/jcjone/p/12159038.html