From 7dade32688e4a55be1f95db74b512da63866ae2e Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Mon, 27 Jun 2022 13:33:03 +0000 Subject: [PATCH] refactor(userspace/falco): make sinsp logging part of the configuration (default to false) Signed-off-by: Jason Dellaluce --- falco.yaml | 11 +++++++++++ userspace/falco/configuration.cpp | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/falco.yaml b/falco.yaml index e7ef2b75..82ae4c06 100644 --- a/falco.yaml +++ b/falco.yaml @@ -98,6 +98,17 @@ log_syslog: true # "alert", "critical", "error", "warning", "notice", "info", "debug". log_level: info +# Falco is capable of managing the logs coming from libs. If enabled, +# the libs logger send its log records the same outputs supported by +# Falco (stderr and syslog). Disabled by default. +libs_logger: + enabled: false + # Minimum log severity to include in the libs logs. Note: this value is + # separate from the log level of the Falco logger and does not affect it. + # Can be one of "fatal", "critical", "error", "warning", "notice", + # "info", "debug", "trace". + severity: debug + # Minimum rule priority level to load and run. All rules having a # priority more severe than this level will be loaded/run. Can be one # of "emergency", "alert", "critical", "error", "warning", "notice", diff --git a/userspace/falco/configuration.cpp b/userspace/falco/configuration.cpp index f6e53026..2ee28af6 100644 --- a/userspace/falco/configuration.cpp +++ b/userspace/falco/configuration.cpp @@ -183,6 +183,12 @@ void falco_configuration::init(string conf_filename, const vector &cmdli falco_logger::set_level(m_log_level); + + falco_logger::set_sinsp_logging( + m_config->get_scalar("libs_logger.enabled", false), + m_config->get_scalar("libs_logger.severity", "debug"), + "[libs]: "); + m_output_timeout = m_config->get_scalar("output_timeout", 2000); m_notifications_rate = m_config->get_scalar("outputs.rate", 1);