aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-08 13:03:46 +0000
committerGitHub <noreply@github.com>2017-03-08 13:03:46 +0000
commita060326c85beea9057da0ee913b2cf0bbfe9529b (patch)
tree263472211148aaa06d58af9ebcea07f957a55a8f /src
parentfeed999517dada912c26db198a00d6e63a6f5a9c (diff)
parentacabcbf89982f2824aaacf53f8be0c471e48a2f3 (diff)
downloadrspamd-a060326c85beea9057da0ee913b2cf0bbfe9529b.tar.gz
rspamd-a060326c85beea9057da0ee913b2cf0bbfe9529b.zip
Merge pull request #1500 from fatalbanana/rg
[Fix] Fix log line duplication in `rspamadm grep`
Diffstat (limited to 'src')
-rw-r--r--src/rspamadm/grep.lua13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/rspamadm/grep.lua b/src/rspamadm/grep.lua
index c5527680b..e49977a1d 100644
--- a/src/rspamadm/grep.lua
+++ b/src/rspamadm/grep.lua
@@ -1,7 +1,6 @@
return function(_, res)
local rspamd_regexp = require 'rspamd_regexp'
- local E = {}
local buffer = {}
local matches = {}
@@ -47,9 +46,11 @@ return function(_, res)
else
for line in h:lines() do
local hash = string.match(line, '^%d+-%d+-%d+ %d+:%d+:%d+ #%d+%(%a+%) <(%x+)>')
+ local already_matching = false
if hash then
if matches[hash] then
table.insert(matches[hash], line)
+ already_matching = true
else
if buffer[hash] then
table.insert(buffer[hash], line)
@@ -74,14 +75,8 @@ return function(_, res)
print(line)
print()
end
- else
- if matches[hash] then
- table.insert(matches[hash], line)
- else
- local cur = buffer[hash] or E
- table.insert(cur, line)
- matches[hash] = cur
- end
+ elseif not already_matching then
+ matches[hash] = buffer[hash]
end
end
local is_end = string.match(line, '^%d+-%d+-%d+ %d+:%d+:%d+ #%d+%(%a+%) <%x+>; task; rspamd_protocol_http_reply:')