Skip to content

Commit

Permalink
Fix output methods that take configurations.
Browse files Browse the repository at this point in the history
The falco engine changes broke the output methods that take
configuration (like the filename for file output, or the program for
program output). Fix that by properly passing the options argument to
each method's output function.
  • Loading branch information
mstemm committed Aug 23, 2016
1 parent 3ee1c0f commit 23a9b6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions userspace/falco/lua/output.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ function mod.file_validate(options)

end

function mod.file(level, msg)
function mod.file(level, msg, options)
file = io.open(options.filename, "a+")
file:write(msg, "\n")
file:close()
end

function mod.syslog(level, msg)
function mod.syslog(level, msg, options)
falco.syslog(level, msg)
end

function mod.program(level, msg)
function mod.program(level, msg, options)
-- XXX Ideally we'd check that the program ran
-- successfully. However, the luajit we're using returns true even
-- when the shell can't run the program.
Expand Down Expand Up @@ -61,7 +61,7 @@ function output_event(event, rule, priority, format)
msg = falco.format_event(event, rule, levels[level+1], formatter)

for index,o in ipairs(outputs) do
o.output(level, msg)
o.output(level, msg, o.config)
end

falco.free_formatter(formatter)
Expand Down

0 comments on commit 23a9b6e

Please sign in to comment.