Skip to content

Commit

Permalink
fix(userspace/falco): fix event set selection for plugin with parsing…
Browse files Browse the repository at this point in the history
… capability.

In live mode we need to use the source_info inspectors instead of the offline inspector.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Oct 7, 2024
1 parent 2579382 commit f72e6a5
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions userspace/falco/app/actions/configure_interesting_sets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,27 @@ static void select_event_set(falco::app::state& s,

/* Load PPM event codes needed by plugins with parsing capability */
libsinsp::events::set<ppm_event_code> plugin_ev_codes;
for(const auto& p : s.offline_inspector->get_plugin_manager()->plugins()) {
if(!(p->caps() & CAP_PARSING)) {
continue;
if(s.is_capture_mode()) {
// In capture mode, we need to use the offline inspector
// because plugins are inited under it; see init_inspectors action.
for(const auto& p : s.offline_inspector->get_plugin_manager()->plugins()) {
if(!(p->caps() & CAP_PARSING)) {
continue;
}
plugin_ev_codes.merge(p->parse_event_codes());
}
} else {
// In live mode, we need to use inspectors from the loaded sources,
// because plugins are inited under them; see init_inspectors action.
for(const auto& src : s.loaded_sources) {
auto src_info = s.source_infos.at(src);
for(const auto& p : src_info->inspector->get_plugin_manager()->plugins()) {
if(!(p->caps() & CAP_PARSING)) {
continue;
}
plugin_ev_codes.merge(p->parse_event_codes());
}
}
plugin_ev_codes.merge(p->parse_event_codes());
}
const auto plugin_sc_set = libsinsp::events::event_set_to_sc_set(plugin_ev_codes);
const auto plugin_names = libsinsp::events::sc_set_to_event_names(plugin_sc_set);
Expand Down

0 comments on commit f72e6a5

Please sign in to comment.