Skip to content

Commit cd0d607

Browse files
LucaGuerrapoiana
authored andcommitted
update(falco): add warning if the append condition does not appear to make sense
Signed-off-by: Luca Guerra <[email protected]>
1 parent 5c959d0 commit cd0d607

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

userspace/falco/configuration.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,28 @@ void falco_configuration::load_yaml(const std::string& config_name)
602602
m_config.get_sequence<std::vector<rule_selection_config>>(m_rules_selection, "rules");
603603
m_config.get_sequence<std::vector<append_output_config>>(m_append_output, "append_output");
604604

605+
// check if append_output matching conditions are sane, if not emit a warning
606+
for (auto const& entry : m_append_output)
607+
{
608+
if (entry.m_rule != "" && entry.m_tags.size() > 0)
609+
{
610+
std::string tag_list;
611+
612+
for (auto const& tag : entry.m_tags)
613+
{
614+
tag_list += tag;
615+
tag_list += ", ";
616+
}
617+
618+
tag_list.pop_back();
619+
620+
falco_logger::log(falco_logger::level::WARNING,
621+
"An append_ouptut entry specifies both a rule (" + entry.m_rule + ") and a list of tags (" + tag_list + std::string("). ") +
622+
"This means that output will be appended only to the " + entry.m_rule + " rule and only if it has " +
623+
"all the tags: " + tag_list + ".");
624+
}
625+
}
626+
605627
std::vector<std::string> load_plugins;
606628

607629
bool load_plugins_node_defined = m_config.is_defined("load_plugins");

0 commit comments

Comments
 (0)