diff options
Diffstat (limited to 'logs.lua')
-rw-r--r-- | logs.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/logs.lua b/logs.lua new file mode 100644 index 0000000..051f2a7 --- /dev/null +++ b/logs.lua @@ -0,0 +1,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 |