Chinaunix首页 | 论坛 | 博客
  • 博客访问: 915371
  • 博文数量: 75
  • 博客积分: 1216
  • 博客等级: 少尉
  • 技术积分: 1998
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-11 16:20
个人简介

优秀是一种习惯

文章分类

全部博文(75)

文章存档

2014年(1)

2013年(29)

2012年(45)

分类: Python/Ruby

2013-02-22 16:26:51

日志格式如下:

127.0.0.1 - - [03/Feb/2013:14:18:10 +0800] "GET /ucenterrvicecenter/SCenterRequest.php HTTP/1.0" 302 242

127.0.0.1 - - [03/Feb/2013:14:18:10 +0800] "GET /ucenterrvicecenter/SCenterRequest.php HTTP/1.0" 200 -
111.111.111.35 - - [03/Feb/2013:14:18:32 +0800] "GET /myadmin/ HTTP/1.1" 401 933
111.111.111.35 - root [03/Feb/2013:14:18:33 +0800] "GET /myadmin/ HTTP/1.1" 200 1826
111.111.111.35 - root [03/Feb/2013:14:18:34 +0800] "GET /myadmin/main.php?token=67b1c9d29f9ac9107627bb991c8d2ca6 HTTP/1.1" 200 7633
111.111.111.35 - - [03/Feb/2013:14:18:34 +0800] "GET /myadmin/css/print.css?token=67b1c9d29f9ac9107627bb991c8d2ca6 HTTP/1.1" 200 1063
111.111.111.35 - root [03/Feb/2013:14:18:34 +0800] "GET /myadmin/css/phpmyadmin.css.php?token=67b1c9d29f9ac9107627bb991c8d2ca6&js_frame=right&nocache=1359872314 HTTP/1.1" 200 20322
111.111.111.35 - root [03/Feb/2013:14:18:34 +0800] "GET /myadmin/navigation.php?token=67b1c9d29f9ac9107627bb991c8d2ca6 HTTP/1.1" 200 1362
111.111.111.35 - root [03/Feb/2013:14:18:36 +0800] "GET /myadmin/css/phpmyadmin.css.php?token=67b1c9d29f9ac9107627bb991c8d2ca6&js_frame=left&nocache=1359872314 HTTP/1.1" 200 3618

111.111.111.35 - root [03/Feb/2013:14:18:38 +0800] "GET /myadmin/navigation.php?server=1&db=ucenter&table=&lang=zh-utf-8&collation_connection=utf8_unicode_ci HTTP/1.1" 200 9631


代码如下:

[root@localhost sampdb]# awk -vFS="[:]" '{gsub("-.*","",$1);num[$2" "$1]++}END{for(i in num)print i,num[i]}' data1
14 127.0.0.1  2
14 111.111.111.35  8

阅读(6088) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~