Shell version of nginx log spider crawling view script
Just change the path of nginx log before use
If more spiders themselves can be added to the code spider UA array
#!/bin/bash
m="$(date +%m)"
case $m in
"01") m='Jan';;
"02") m='Feb';;
"03") m='Mar';;
"04") m='Apr';;
"05") m='May';;
"06") m='June';;
"07") m='July';;
"08") m='Aug';;
"09") m='Sept';;
"10") m='Oct';;
"11") m='Nov';;
"12") m='Dec';;
esac
d="$(date +%d)"
spider=(
Googlebot
Baiduspider
Sogou
YisouSpider
360Spider
)
for i in ${spider[*]}; do
Echo - e "$I \ T" ` cat modify here to nginx access log | grep $D / $m | grep $I | WC - L`
done
The above is the whole content of this article. I hope it can be helpful for you to be familiar with shell scripts.