如何使用以下访问日志获取 uniq 报告 [英] How to get uniq report with the below access log

查看:22
本文介绍了如何使用以下访问日志获取 uniq 报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

输入

Severity: Warning   Missing argument 1 for Pxxer_rzxczt_v3::mast() /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115/dadm/index.php/plasdasd/mast/  
Severity: Warning   Missing argument 1 for Pxxer_rzxczt_v3::mast() /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115/dadm/index.php/plasdasd/mast/  
Severity: Warning   Missing argument 1 for Pxxer_rzxczt_v3::mast() /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115/dadm/index.php/plasdasd/mast/  
Severity: Notice   Undefined variable: vedwe erwer rew  /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130/dadm/index.php/plasdasd/mast/  
Severity: Notice   Undefined variable: vedwe erwer rew  /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130/dadm/index.php/plasdasd/mast/  
Severity: Notice   Undefined variable: vCode /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130/dadm/index.php/plasdasd/mast/  
Severity: Notice   Undefined variable: vCode /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130/dadm/index.php/plasdasd/mast/  
Severity: Notice   Undefined variable: vCode /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130/dadm/index.php/plasdasd/mast/  

输出

Severity: Warning   Missing argument 1 for Pxxer_rzxczt_v3::mast() /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115  - 3  
Severity: Notice   Undefined variable: vCode /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130   -  3   
Severity: Notice   Undefined variable: vedwe erwer rew  /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130   -  2  

推荐答案

uniq unix 命令使用 -c 选项执行您想要的操作.

The uniq unix command does what you want, with the -c option.

cat yourlog |uniq -c 将输出

   1 everity: Warning   Missing argument 1 for Pxxer_rzxczt_v3::mast() /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115/dadm/index.php/plasdasd/mast/  
   2 Severity: Warning   Missing argument 1 for Pxxer_rzxczt_v3::mast() /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115/dadm/index.php/plasdasd/mast/  
   2 Severity: Notice   Undefined variable: vedwe erwer rew  /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130/dadm/index.php/plasdasd/mast/  
   3 Severity: Notice   Undefined variable: vCode /sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130/dadm/index.php/plasdasd/mast/  

然而,这会使不直接重复的重复行在不同的行上计数.

This will however make repeated lines that are not directly repeated after each other to be counted up on different lines.

例如输入:

foo
foo
bar
bar
foo
foo

将给出输出:

2 foo
2 bar
2 foo

如果你想要输出

2 bar
4 foo

您首先必须对文件进行排序,如下所示:

you would first have to sort the file, like this:

cat yourlog | sort | uniq -c

这篇关于如何使用以下访问日志获取 uniq 报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆