统计下载日志流量,ip等各项信息的shell脚本代码
2015-04-08 17:26
886 查看
Qiniu 七牛问题解答
问题描述
问题解决方案
#! /bin/bash echo "example:" "--------./log-test.sh 404 2015-04-07 REQ_IO 11-00 do_not_delete/noc.gif----------------------------------------------------------" code=$1 echo "the code is ${code} " date=$2 echo "the date is ${date}" operation=$3 echo "the operation is ${operation}" time=$4 echo "the time is ${time}" domain=$5 echo "the domain is ${domain}" key=$6 echo "the key is ${key}" if [ "$operation" = "REQ_IO" -a "$code" = "404" ]; then echo "searching code 404-content............waiting for a while" hdfs dfs -cat /flume/${date}/${operation}/${time}/*.log|awk '$7==200{print $0}' | grep ${content}| head -10 fi if [ "$operation" = "REQ_IO" -a "$domain" != "" ]; then echo "searching code 404-content............waiting for a while" hdfs dfs -cat /flume/${date}/${operation}/${time}/*.log|awk '{if(substr($0, index($0, "Host") + 7, 20)~/'$domain'/) {print $0}}'|awk '{ if($7==200) { sum=sum+$9 }} END {print " the amount is " int(sum/(1024*1024)) " M"}' | head -10 fi
结果演示
参考文档:七牛云存储 C SDK 使用指南许可证
Copyright (c) 2012 qiniu.com相关文章推荐
- python脚本实现统计日志文件中的ip访问次数代码分享
- python脚本实现统计日志文件中的ip访问次数代码分享
- shell脚本自动修改IP信息
- python统计日志ip访问数脚本
- 为C++代码批量添加版权信息的shell脚本
- shell脚本实现的网站日志分析统计(可以统计9种数据)
- python 脚本统计squid日志中的IP访问数和URL访问数量
- 使用shell统计ip的流量
- Linux下使用Shell脚本实现ftp的自动上传下载的代码小结
- shell脚本---统计文件夹下文件类型信息
- 用shell脚本收集查询IP信息的网站
- 使用shell脚本分析网站日志统计PV、404、500等数据
- Linux下使用Shell脚本实现ftp的自动上传下载的代码小结
- shell脚本自动修改IP信息
- 使用shell脚本统计各个模块每个文件代码行数与总行数
- 自己用shell+shell脚本自动修改IP信息
- Shell脚本定时备份清除运行系统日志的代码
- 每日把前天日志下载下来的shell脚本
- shell脚本每天自动统计网站访问日志
- 统计CDN的尝试下载IP数和下载成功IP数做的一个CDN统计脚本