Shell version of nginx log spider crawling view script

Time:2022-5-14

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.

Recommended Today

Skills of realizing chrome tab bar with CSS

This time, let’s look at a navigation bar layout with special rounded corners, as shown in the tag bar of Google Browser: How can such a layout be realized? Several methods are introduced below 1、 Pseudo element splicing Suppose there is such an HTML structure <nav class=”tab”> <a class=”tab-item”>Svelte API</a> <a class=”tab-item active”>Svelte API</a> <a […]