Add "json_pretty" log format, currently the same as "json".

In a future version, "json" will be an alias for "json_compact"
instead.  GitHub issue #357.
This commit is contained in:
Todd C. Miller
2024-03-09 10:59:54 -07:00
parent 1debad3bec
commit 46e31a74d7
14 changed files with 135 additions and 92 deletions

View File

@@ -1554,3 +1554,30 @@ sudoers_get_context(void)
{
return &sudoers_ctx;
}
bool
sudoers_set_log_format(enum def_tuple tuple)
{
enum eventlog_format format;
debug_decl(cb_log_format, SUDOERS_DEBUG_PLUGIN);
switch (tuple) {
case json:
format = EVLOG_JSON;
break;
case json_compact:
format = EVLOG_JSON_COMPACT;
break;
case json_pretty:
format = EVLOG_JSON_PRETTY;
break;
case sudo:
format = EVLOG_SUDO;
break;
default:
debug_return_bool(false);
}
eventlog_set_format(format);
debug_return_bool(true);
}