mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-27 23:27:20 +00:00
fix(userspace/falco): output needs to be initialized after fork
Co-Authored-By: Leonardo Grasso <me@leonardograsso.com> Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com> Signed-off-by: Lorenzo Fontana <lo@linux.com>
This commit is contained in:
parent
c736689f6f
commit
7691dba3ff
@ -762,8 +762,6 @@ int falco_init(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs = new falco_outputs();
|
|
||||||
|
|
||||||
// Some combinations of arguments are not allowed.
|
// Some combinations of arguments are not allowed.
|
||||||
if (daemon && pidfilename == "") {
|
if (daemon && pidfilename == "") {
|
||||||
throw std::invalid_argument("If -d is provided, a pid file must also be provided");
|
throw std::invalid_argument("If -d is provided, a pid file must also be provided");
|
||||||
@ -965,14 +963,6 @@ int falco_init(int argc, char **argv)
|
|||||||
hostname = c_hostname;
|
hostname = c_hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs->init(config.m_json_output,
|
|
||||||
config.m_json_include_output_property,
|
|
||||||
config.m_output_timeout,
|
|
||||||
config.m_notifications_rate, config.m_notifications_max_burst,
|
|
||||||
config.m_buffered_outputs,
|
|
||||||
config.m_time_format_iso_8601,
|
|
||||||
hostname);
|
|
||||||
|
|
||||||
if(!all_events)
|
if(!all_events)
|
||||||
{
|
{
|
||||||
inspector->set_drop_event_flags(EF_DROP_SIMPLE_CONS);
|
inspector->set_drop_event_flags(EF_DROP_SIMPLE_CONS);
|
||||||
@ -992,11 +982,6 @@ int falco_init(int argc, char **argv)
|
|||||||
|
|
||||||
inspector->set_hostname_and_port_resolution_mode(false);
|
inspector->set_hostname_and_port_resolution_mode(false);
|
||||||
|
|
||||||
for(auto output : config.m_outputs)
|
|
||||||
{
|
|
||||||
outputs->add_output(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(signal(SIGINT, signal_callback) == SIG_ERR)
|
if(signal(SIGINT, signal_callback) == SIG_ERR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "An error occurred while setting SIGINT signal handler.\n");
|
fprintf(stderr, "An error occurred while setting SIGINT signal handler.\n");
|
||||||
@ -1082,6 +1067,21 @@ int falco_init(int argc, char **argv)
|
|||||||
g_daemonized = true;
|
g_daemonized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outputs = new falco_outputs();
|
||||||
|
|
||||||
|
outputs->init(config.m_json_output,
|
||||||
|
config.m_json_include_output_property,
|
||||||
|
config.m_output_timeout,
|
||||||
|
config.m_notifications_rate, config.m_notifications_max_burst,
|
||||||
|
config.m_buffered_outputs,
|
||||||
|
config.m_time_format_iso_8601,
|
||||||
|
hostname);
|
||||||
|
|
||||||
|
for(auto output : config.m_outputs)
|
||||||
|
{
|
||||||
|
outputs->add_output(output);
|
||||||
|
}
|
||||||
|
|
||||||
if(trace_filename.size())
|
if(trace_filename.size())
|
||||||
{
|
{
|
||||||
// Try to open the trace file as a sysdig
|
// Try to open the trace file as a sysdig
|
||||||
|
Loading…
Reference in New Issue
Block a user