From 852bb940a2d0310d461c0ec6b0d32716d986357a Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 30 Jan 2015 11:31:41 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=89=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=B8=AD=E6=97=A5=E5=BF=97=E5=88=86=E6=9E=90=E7=9A=84?= =?UTF-8?q?=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/system_log_helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/system_log_helper.rb b/app/helpers/system_log_helper.rb index 918d6a608..12e02ca8f 100644 --- a/app/helpers/system_log_helper.rb +++ b/app/helpers/system_log_helper.rb @@ -25,11 +25,17 @@ module SystemLogHelper logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) } #将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。 logs.collect! do |log| - keywords.each { |r| log.gsub!(r, '\0') } + keywords.each { |r| log.gsub!(r, '\0') && log = "" if log =~ Regexp.new("SystemLogController",'i') } log end + else logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) } + # 过滤掉日志中日志分析请求 + logs.collect! do |log| + log = "" if log =~ Regexp.new("SystemLogController",'i') + log + end end logs end From e761cd5f221939e55708d9fe2b3db284cd40afe3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 30 Jan 2015 11:52:37 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=BC=9A=E4=B8=A2=E5=A4=B1=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/system_log_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/system_log_helper.rb b/app/helpers/system_log_helper.rb index 12e02ca8f..5412339de 100644 --- a/app/helpers/system_log_helper.rb +++ b/app/helpers/system_log_helper.rb @@ -25,7 +25,10 @@ module SystemLogHelper logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) } #将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。 logs.collect! do |log| - keywords.each { |r| log.gsub!(r, '\0') && log = "" if log =~ Regexp.new("SystemLogController",'i') } + if log =~ Regexp.new("SystemLogController",'i') + log = "" + end + keywords.each { |r| log.gsub!(r, '\0') } log end From 0232826a6e2b1017596f626a567fc69c6cb3d2b2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 30 Jan 2015 12:04:33 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=B8=8A=E6=AC=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BC=95=E5=85=A5bug:=E5=85=B3=E9=94=AE=E5=AD=97=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=B8=8D=E5=88=B0=E4=BB=BB=E4=BD=95=E4=B8=9C=E8=A5=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/system_log_helper.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/helpers/system_log_helper.rb b/app/helpers/system_log_helper.rb index 5412339de..2ca5baaed 100644 --- a/app/helpers/system_log_helper.rb +++ b/app/helpers/system_log_helper.rb @@ -19,15 +19,12 @@ module SystemLogHelper keywords = keywords.strip.split(/\s+/).collect! { |w| Regexp.new(w, 'i') } # 一条记录应该匹配每个关键字 log =~ r 是对log记录进行判断是否符合r的正则表达式 logs = logs.find_all do |log| - keywords.all? { |r| log =~ r } + keywords.all? { |r| log =~ r && !(log =~ Regexp.new("SystemLogController#",'i')) } end #用Kaminari分页 logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) } #将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。 logs.collect! do |log| - if log =~ Regexp.new("SystemLogController",'i') - log = "" - end keywords.each { |r| log.gsub!(r, '\0') } log end From abc5dd1c74645b0a3cd665860910a5d10bcb03da Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 30 Jan 2015 12:07:07 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/system_log/access_analysis.html.erb | 15 ++++++++++++++- app/views/system_log/index.html.erb | 17 +++++++++++++++-- app/views/system_log/time_analysis.html.erb | 12 ++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/app/views/system_log/access_analysis.html.erb b/app/views/system_log/access_analysis.html.erb index 631530370..371c2bc33 100644 --- a/app/views/system_log/access_analysis.html.erb +++ b/app/views/system_log/access_analysis.html.erb @@ -4,7 +4,20 @@ @nav_dispaly_main_contest_label = 1 %> <% @nav_dispaly_forum_label = 1%> - +