diff --git a/zconf/chp/chpstat/chpstat.8 b/zconf/chp/chpstat/chpstat.8 index f2e6542f..3d15e39d 100644 --- a/zconf/chp/chpstat/chpstat.8 +++ b/zconf/chp/chpstat/chpstat.8 @@ -384,6 +384,17 @@ with an ASCII Record Separator character (0x1e) and suffixed with an ASCII Line Feed character (0x0a) in accordance with RFC7464. .br +See section "OUTPUT FORMAT" for more details. +.BR +.PP +.IP \(bu 3 +.B jsonl: +Line-delimited JSON data structures + +Data for each iteration is formatted as a single JSON data structure separated +by an ASCII Line Feed character (0x0a, LF). +.BR + See section "OUTPUT FORMAT" for more details. .br .PP @@ -736,6 +747,12 @@ Subsequent objects each represent channel-path statistics data for one iteration .br .PP +.SS jsonl + +The jsonl output format is a data streaming variation of the JSON output format +described above with the same properties as the json\-seq output with the +difference that JSON data is separated only by an ASCII Line Feed character +(0x0a, LF). .SH "EXIT CODES" .TP diff --git a/zconf/chp/chpstat/chpstat.c b/zconf/chp/chpstat/chpstat.c index 699aa132..8e08c069 100644 --- a/zconf/chp/chpstat/chpstat.c +++ b/zconf/chp/chpstat/chpstat.c @@ -1270,7 +1270,7 @@ static void cmd_list(void) if (opts.groups & KEY_GRP_METRICS) update_util_all(true); - if (opts.fmt != FMT_JSONSEQ) + if (!util_fmt_is_json_stream(opts.fmt)) util_fmt_obj_start(FMT_LIST, NULL); for (i = 0; opts.forever || i < opts.iterations; i++) { if (i > 0) @@ -1286,7 +1286,7 @@ static void cmd_list(void) * via pipes (e.g. for use with grep). */ fflush(stdout); } - if (opts.fmt != FMT_JSONSEQ) + if (!util_fmt_is_json_stream(opts.fmt)) util_fmt_obj_end(); } @@ -1972,7 +1972,7 @@ static void init_fmt(void) flags |= FMT_FILTER; if (!opts.use_prefix) flags |= FMT_NOPREFIX; - if (opts.fmt == FMT_JSON || opts.fmt == FMT_JSONSEQ) { + if (util_fmt_is_json(opts.fmt)) { /* Ensure correct JSON even if interrupted. */ flags |= FMT_HANDLEINT; }