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

Using -o json together with -q outputs broken json #296

Closed
liskaant opened this issue Jul 11, 2021 · 1 comment
Closed

Using -o json together with -q outputs broken json #296

liskaant opened this issue Jul 11, 2021 · 1 comment

Comments

@liskaant
Copy link

When using quiet mode together with JSON output format the beginning [ is not printed.

As far as I can tell it is caused by the json_prolog function not being called in quiet mode:

nfdump/bin/output_json.c

Lines 79 to 83 in 1f61277

void json_prolog(void) {
recordCount = 0;
memset(data_string, 0, STRINGSIZE);
printf("[\n");
} // End of json_prolog

nfdump/bin/nfdump.c

Lines 1129 to 1131 in 1f61277

if ( !(flow_stat || element_stat || wfile || outputParams->quiet ) && print_prolog ) {
print_prolog();
}

The recordCount and memset lines not being called might also cause issues with unitialized variables.

@phaag
Copy link
Owner

phaag commented Jul 16, 2021

Thanks for the report.
Fix in commit 5850f57.

@phaag phaag closed this as completed Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants