Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(userspace/engine): changed format of the 'output' field in the JSON payload #3037

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions userspace/engine/formats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ std::string falco_formats::format_event(sinsp_evt *evt, const std::string &rule,

formatter = m_falco_engine->create_formatter(source, format);

// Format the original output string, regardless of output format
formatter->tostring_withformat(evt, line, sinsp_evt_formatter::OF_NORMAL);

if(formatter->get_output_format() == sinsp_evt_formatter::OF_JSON)
{
std::string json_line;
Expand Down Expand Up @@ -89,6 +86,7 @@ std::string falco_formats::format_event(sinsp_evt *evt, const std::string &rule,
if(m_json_include_output_property)
{
// This is the filled-in output line.
formatter->tostring_withformat(evt, line, sinsp_evt_formatter::OF_JSON);
event["output"] = line;
}

Expand Down Expand Up @@ -127,6 +125,10 @@ std::string falco_formats::format_event(sinsp_evt *evt, const std::string &rule,
full_line.append("}");
line = full_line;
}
else
{
formatter->tostring_withformat(evt, line, sinsp_evt_formatter::OF_NORMAL);
}

return line;
}
Expand Down
Loading