Home > OS >  Pray god help me do the thank you
Pray god help me do the thank you

Time:10-05

IP {110.167.95.97} - [17/Jul 2019:07:05:56 + 0800] "request method {GET} {}/admin3 asp page HTTP/1.1" status code {301} 284 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64. The rv: 7.0.1) Gecko browser/20100101 name {Firefox/7.0.1}
"
Help me to split the data for IP separately store to request method separately store a file to a file request page separately store status code to a file storage to store a file name of the user's browser to a file

Help me how many IP output different IP how many
Help me GET request output how many times how many times a POST request method
Help me to output a status code of 200 have? How many a
Help me to statistics which browser users use ~ most times

CodePudding user response:

Treated with awk bai
Awk '{print $1}' log print with a space in the log file for the first field separator, to paraphrase, you can also add -f option awk -f ":" '{print $2}' promise to colon delimiter second field
As for the statistics, you can use the awk, also can use grep, uniq, such as sort and uniq to heavy, uniq -c to heavy, repeat the number of rows, and statistics figures will write in the back; The sort order
Such as IP output to IP. TXT cat IP. TXT | wc -l statistics how many IP; The cat IP. TXT | sort | uniq - d what are the different IP; The cat IP. TXT | sort | uniq -c statistics how many each IP

Baidu up how to do

CodePudding user response:

Such as take IP
The awk - F "} "' {print $1} 'log | awk -f" {"' {print $2} '& gt; IP. TXT first take}, for the first part of the separator, namely IP {110.167.95.97, then take to {separator part 2, the world is IP 110.167.95.97
  • Related