23、网站日志分析与远程备份脚本详解

网站日志分析与远程备份脚本详解

1. 理解搜索引擎流量

1.1 脚本目的

分析搜索引擎流量,不仅能了解哪些搜索引擎带来了流量,还能知道通过搜索引擎访问网站的用户输入了哪些关键词。这有助于判断网站是否被搜索引擎正确索引,并为提高网站在搜索引擎中的排名和相关性提供起点。

1.2 代码实现

#!/bin/sh
# searchinfo - Extracts and analyzes search engine traffic indicated in the
#    referrer field of a Common Log Format access log.
host="intuitive.com"    # change to your domain, as desired
maxmatches=20
count=0
temp="/tmp/$(basename $0).$$"
trap "/bin/rm -f $temp" 0
if [ $# -eq 0 ] ; then
  echo "Usage: $(basename $0) logfile" >&2
  exit 1
fi
if [ ! -r "$1" ] ; then
  echo "Error: can't open file $1 for analysis." >&2
  exit 1
fi
for URL in $(awk '{ if (length($11) > 4) { print $11 } }' "$1" | \
  grep -vE "(/www.$host|/$host)" | gre
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值