Skip to content

Commit

Permalink
update(falco): add warning if the append condition does not appear to…
Browse files Browse the repository at this point in the history
… make sense

Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Sep 13, 2024
1 parent 5c959d0 commit cd0d607
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions userspace/falco/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,28 @@ void falco_configuration::load_yaml(const std::string& config_name)
m_config.get_sequence<std::vector<rule_selection_config>>(m_rules_selection, "rules");
m_config.get_sequence<std::vector<append_output_config>>(m_append_output, "append_output");

// check if append_output matching conditions are sane, if not emit a warning
for (auto const& entry : m_append_output)
{
if (entry.m_rule != "" && entry.m_tags.size() > 0)
{
std::string tag_list;

for (auto const& tag : entry.m_tags)
{
tag_list += tag;
tag_list += ", ";
}

tag_list.pop_back();

falco_logger::log(falco_logger::level::WARNING,
"An append_ouptut entry specifies both a rule (" + entry.m_rule + ") and a list of tags (" + tag_list + std::string("). ") +
"This means that output will be appended only to the " + entry.m_rule + " rule and only if it has " +
"all the tags: " + tag_list + ".");
}
}

std::vector<std::string> load_plugins;

bool load_plugins_node_defined = m_config.is_defined("load_plugins");
Expand Down

0 comments on commit cd0d607

Please sign in to comment.