diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2018-04-16 10:30:15 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2018-04-16 10:30:15 +0200 |
commit | 55783753ae8f2d857a7225b7a93c1d47039e5a90 (patch) | |
tree | e077b61b0f004141712e7d16876f9c19175ac681 /logs.lua | |
download | conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.gz conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.bz2 conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.xz conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.zip |
OpenShift monitoring
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 |