blob: 051f2a797c69b7f708652f1ffb88f7a64173a08a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
require "luarocks.require"
rex_pcre = require "rex_pcre"
do
function conky_filter_syslog(log, lines)
local data = conky_parse('${tail ' .. log .. ' ' .. lines .. ')}')
-- return rex_pcre.gsub(data,"(MAC|OUT|IN|TOS|PREC|ID|RES)=[\\w\\d:]*\\s", "")
local lines = rex_pcre.split(data, "\\x02")
local res = {}
for line in lines do
if (rex_pcre.match(line, "\\*\\*\\*\\s*(PortScan|SynFlood.*|BlackList|Fragments|DeathPing)\\s*\\*\\*\\*")) then
local fixed = rex_pcre.gsub(line,"(MAC|OUT|IN|TOS|PREC|ID|RES)=[\\w\\d:]*\\s", "")
table.insert(res, fixed)
else
table.insert(res, line)
end
end
return table.concat(res, "\n")
end
end
|