mirror of https://github.com/OISF/suricata
output-lua: add example packet log script
Example packet log script that outputs to stdout in the alert- fast log format.pull/1112/head
parent
b60e28e1a4
commit
684afc7f4e
@ -0,0 +1,38 @@
|
||||
-- simple fast-log to stdout lua module
|
||||
|
||||
function init (args)
|
||||
local needs = {}
|
||||
needs["type"] = "packet"
|
||||
needs["filter"] = "alerts"
|
||||
return needs
|
||||
end
|
||||
|
||||
function setup (args)
|
||||
alerts = 0
|
||||
end
|
||||
|
||||
function log(args)
|
||||
sid = args['sid'];
|
||||
rev = args['rev'];
|
||||
gid = args['gid'];
|
||||
msg = args['msg'];
|
||||
srcip = args['srcip'];
|
||||
dstip = args['dstip'];
|
||||
ts = args['ts'];
|
||||
class = args['class'];
|
||||
prio = args['priority'];
|
||||
proto = args['ipproto'];
|
||||
sp = args['sp'];
|
||||
dp = args['dp'];
|
||||
|
||||
print (ts .. " [**] [" .. gid .. ":" .. sid .. ":" .. rev .. "] " ..
|
||||
msg .. " [**] [Classification: " .. class .. "] [Priority: " ..
|
||||
prio .. "] {" .. proto .. "} " ..
|
||||
srcip .. ":" .. sp .. " -> " .. dstip .. ":" .. dp)
|
||||
|
||||
alerts = alerts + 1;
|
||||
end
|
||||
|
||||
function deinit (args)
|
||||
print ("Alerted " .. alerts .. " times");
|
||||
end
|
||||
Loading…
Reference in New Issue