如何获得与下面的访问日志报告的uniq [英] How to get uniq report with the below access log
本文介绍了如何获得与下面的访问日志报告的uniq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
输入
严重性:警告缺少参数1 Pxxer_rzxczt_v3 ::桅杆()/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115 / DADM / index.php文件/ plasdasd /桅杆/
严重性:警告缺少参数1 Pxxer_rzxczt_v3 ::桅杆()/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115 / DADM / index.php文件/ plasdasd /桅杆/
严重性:警告缺少参数1 Pxxer_rzxczt_v3 ::桅杆()/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115 / DADM / index.php文件/ plasdasd /桅杆/
严重性:注意未定义的变量:vedwe erwer REW /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130 / DADM / index.php文件/ plasdasd /桅杆/
严重性:注意未定义的变量:vedwe erwer REW /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130 / DADM / index.php文件/ plasdasd /桅杆/
严重性:通知未定义变量:V $ C $ç/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130 / DADM / index.php文件/ plasdasd /桅杆/
严重性:通知未定义变量:V $ C $ç/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130 / DADM / index.php文件/ plasdasd /桅杆/
严重性:通知未定义变量:V $ C $ç/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130 / DADM / index.php文件/ plasdasd /桅杆/
输出
严重性:警告缺少了Pxxer_rzxczt_v3 ::桅杆参数1()/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115 - 3
严重性:通知未定义变量:V $ C $Ç/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130 - 3
严重性:注意未定义的变量:vedwe erwer REW /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130 - 2
解决方案
借助的uniq UNIX命令你想要做什么,使用-c选项。
猫yourlog | uniq的-c
将输出
1 everity:警告缺少参数1 Pxxer_rzxczt_v3 ::桅杆()/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115 / DADM /索引。 PHP / plasdasd /桅杆/
2严重性:警告缺少参数1 Pxxer_rzxczt_v3 ::桅杆()/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 115 / DADM / index.php文件/ plasdasd /桅杆/
2严重性:注意未定义的变量:vedwe erwer REW /sdfdsfv/ddw/hdd/nddd/system/adsdn/wefwf/efe/codsds/pr_rt_v3.php 130 / DADM / index.php文件/ plasdasd /桅杆/
3严重性:注意未定义的变量:V $ C $ç/sdfdsfv/ddw/hdd/nddd/system/adsdn/codsds/pr_rt_v3.php 130 / DADM / index.php文件/ plasdasd /桅杆/
这将使得但是那些没有直接经过反复相互不同的线路被计算了重复行。
例如输入:
富
富
酒吧
酒吧
富
富
会给输出:
2富
2条
2富
如果你想输出为
2条
4富
您必须先对文件进行排序,这样的:
猫yourlog |排序| uniq的-c
Input
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/
Output
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
解决方案
The uniq unix command does what you want, with the -c option.
cat yourlog | uniq -c
will output
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.
For example the input:
foo
foo
bar
bar
foo
foo
will give the output:
2 foo
2 bar
2 foo
If you want the output to be
2 bar
4 foo
you would first have to sort the file, like this:
cat yourlog | sort | uniq -c
这篇关于如何获得与下面的访问日志报告的uniq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文