From 55783753ae8f2d857a7225b7a93c1d47039e5a90 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 16 Apr 2018 10:30:15 +0200 Subject: OpenShift monitoring --- logs.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 logs.lua (limited to 'logs.lua') 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 -- cgit v1.2.1