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

Base64 format fix #1033

Merged
merged 1 commit into from
Feb 4, 2020
Merged
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 @@ -145,11 +145,13 @@ int falco_formats::format_event (lua_State *ls)
if(strcmp(source, "syscall") == 0)
{
try {
// This is "output"
s_formatters->tostring((sinsp_evt *) evt, sformat, &line);

if(s_json_output)
{
switch(s_inspector->get_buffer_format())
sinsp_evt::param_fmt cur_fmt = s_inspector->get_buffer_format();
switch(cur_fmt)
{
case sinsp_evt::PF_NORMAL:
s_inspector->set_buffer_format(sinsp_evt::PF_JSON);
Expand All @@ -170,15 +172,15 @@ int falco_formats::format_event (lua_State *ls)
// do nothing
break;
}
// This is output fields
s_formatters->tostring((sinsp_evt *) evt, sformat, &json_line);

// The formatted string might have a leading newline. If it does, remove it.
if (json_line[0] == '\n')
{
json_line.erase(0, 1);
}

s_inspector->set_buffer_format(sinsp_evt::PF_NORMAL);
s_inspector->set_buffer_format(cur_fmt);
}
}
catch (sinsp_exception& e)
Expand Down