Skip to content

Commit

Permalink
cleanup(falco): apply review suggestion about extra_output_field_t
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
Co-authored-by: Federico Di Pierro <[email protected]>
  • Loading branch information
2 people authored and poiana committed Sep 9, 2024
1 parent aeb4126 commit ddc7360
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions userspace/engine/falco_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ namespace falco_common

bool parse_rule_matching(const std::string& v, rule_matching& out);
};

typedef std::unordered_map<std::string, std::pair<std::string, bool>> extra_output_field_t;
2 changes: 1 addition & 1 deletion userspace/engine/falco_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class falco_engine
std::string format;
std::set<std::string> exception_fields;
std::set<std::string> tags;
std::unordered_map<std::string, std::pair<std::string, bool>> extra_output_fields;
extra_output_field_t extra_output_fields;
};

//
Expand Down
2 changes: 1 addition & 1 deletion userspace/engine/falco_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct falco_rule
std::string name;
std::string description;
std::string output;
std::unordered_map<std::string, std::pair<std::string, bool>> extra_output_fields;
extra_output_field_t extra_output_fields;
std::set<std::string> tags;
std::set<std::string> exception_fields;
falco_common::priority_type priority;
Expand Down
2 changes: 1 addition & 1 deletion userspace/engine/formats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ falco_formats::~falco_formats()

std::string falco_formats::format_event(sinsp_evt *evt, const std::string &rule, const std::string &source,
const std::string &level, const std::string &format, const std::set<std::string> &tags,
const std::string &hostname, const std::unordered_map<std::string, std::pair<std::string, bool>> &extra_fields) const
const std::string &hostname, const extra_output_field_t &extra_fields) const
{
std::string line;

Expand Down
2 changes: 1 addition & 1 deletion userspace/engine/formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class falco_formats

std::string format_event(sinsp_evt *evt, const std::string &rule, const std::string &source,
const std::string &level, const std::string &format, const std::set<std::string> &tags,
const std::string &hostname, const std::unordered_map<std::string, std::pair<std::string, bool>> &extra_fields) const;
const std::string &hostname, const extra_output_field_t &extra_fields) const;

std::string format_string(sinsp_evt *evt, const std::string &format, const std::string &source) const;

Expand Down
2 changes: 1 addition & 1 deletion userspace/falco/falco_outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void falco_outputs::add_output(const falco::outputs::config &oc)

void falco_outputs::handle_event(sinsp_evt *evt, const std::string &rule, const std::string &source,
falco_common::priority_type priority, const std::string &format, std::set<std::string> &tags,
std::unordered_map<std::string, std::pair<std::string, bool>> &extra_fields)
extra_output_field_t &extra_fields)
{
falco_outputs::ctrl_msg cmsg = {};
cmsg.ts = evt->get_ts();
Expand Down
2 changes: 1 addition & 1 deletion userspace/falco/falco_outputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class falco_outputs
*/
void handle_event(sinsp_evt *evt, const std::string &rule, const std::string &source,
falco_common::priority_type priority, const std::string &format, std::set<std::string> &tags,
std::unordered_map<std::string, std::pair<std::string, bool>> &extra_fields);
extra_output_field_t &extra_fields);

/*!
\brief Format then send a generic message to all outputs.
Expand Down

0 comments on commit ddc7360

Please sign in to comment.