diff --git a/man/journalctl.xml b/man/journalctl.xml
index cae5312db2..444b916073 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -270,13 +270,23 @@
+
+
+
+
+
+ as for but includes full
+ microsecond precision.
+
+
+
- is very similar, but shows timestamps with full
- microsecond precision.
+ is very similar, but shows classic syslog timestamps
+ with full microsecond precision.
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
index e4ccad8799..907d7dd55b 100644
--- a/shell-completion/bash/systemctl.in
+++ b/shell-completion/bash/systemctl.in
@@ -172,7 +172,7 @@ _systemctl () {
comps='full enable-only disable-only'
;;
--output|-o)
- comps='short short-full short-iso short-precise short-monotonic short-unix verbose export json
+ comps='short short-full short-iso short-iso-precise short-precise short-monotonic short-unix verbose export json
json-pretty json-sse cat'
;;
--machine|-M)
diff --git a/shell-completion/zsh/_sd_outputmodes b/shell-completion/zsh/_sd_outputmodes
index 52617c6b7a..2948f40130 100644
--- a/shell-completion/zsh/_sd_outputmodes
+++ b/shell-completion/zsh/_sd_outputmodes
@@ -1,5 +1,5 @@
#autoload
local -a _output_opts
-_output_opts=(short short-full short-iso short-precise short-monotonic short-unix verbose export json json-pretty json-sse cat)
+_output_opts=(short short-full short-iso short-iso-precise short-precise short-monotonic short-unix verbose export json json-pretty json-sse cat)
_describe -t output 'output mode' _output_opts || compadd "$@"
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index ad11fb314d..f990ac9303 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -299,8 +299,9 @@ static void help(void) {
" --no-tail Show all lines, even in follow mode\n"
" -r --reverse Show the newest entries first\n"
" -o --output=STRING Change journal output mode (short, short-precise,\n"
- " short-iso, short-full, short-monotonic, short-unix,\n"
- " verbose, export, json, json-pretty, json-sse, cat)\n"
+ " short-iso, short-iso-precise, short-full,\n"
+ " short-monotonic, short-unix, verbose, export,\n"
+ " json, json-pretty, json-sse, cat)\n"
" --utc Express time in Coordinated Universal Time (UTC)\n"
" -x --catalog Add message explanations where available\n"
" --no-full Ellipsize fields\n"
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 68cac4cb08..be7acbb54c 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -1386,8 +1386,10 @@ static int help(int argc, char *argv[], void *userdata) {
" --kill-who=WHO Who to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n"
" -n --lines=INTEGER Number of journal entries to show\n"
- " -o --output=STRING Change journal output mode (short, short-monotonic,\n"
- " verbose, export, json, json-pretty, json-sse, cat)\n\n"
+ " -o --output=STRING Change journal output mode (short, short-precise,\n"
+ " short-iso, short-iso-precise, short-full,\n"
+ " short-monotonic, short-unix, verbose, export,\n"
+ " json, json-pretty, json-sse, cat)\n"
"Session Commands:\n"
" list-sessions List sessions\n"
" session-status [ID...] Show session status\n"
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 3031ed5def..a385e6819b 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -2694,9 +2694,10 @@ static int help(int argc, char *argv[], void *userdata) {
" --mkdir Create directory before bind mounting, if missing\n"
" -n --lines=INTEGER Number of journal entries to show\n"
" --max-addresses=INTEGER Number of internet addresses to show at most\n"
- " -o --output=STRING Change journal output mode (short,\n"
- " short-monotonic, verbose, export, json,\n"
- " json-pretty, json-sse, cat)\n"
+ " -o --output=STRING Change journal output mode (short, short-precise,\n"
+ " short-iso, short-iso-precise, short-full,\n"
+ " short-monotonic, short-unix, verbose, export,\n"
+ " json, json-pretty, json-sse, cat)\n"
" --verify=MODE Verification mode for downloaded images (no,\n"
" checksum, signature)\n"
" --force Download image even if already exists\n\n"
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 72c43e80cb..a8c15d93b6 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -264,6 +264,8 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou
}
} else {
+ char usec[7];
+
gettime_r = (flags & OUTPUT_UTC) ? gmtime_r : localtime_r;
t = (time_t) (x / USEC_PER_SEC);
@@ -275,11 +277,21 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou
case OUTPUT_SHORT_ISO:
if (strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S%z", gettime_r(&t, &tm)) <= 0) {
- log_error("Failed for format ISO time");
+ log_error("Failed to format ISO time");
return -EINVAL;
}
break;
+ case OUTPUT_SHORT_ISO_PRECISE:
+ /* No usec in strftime, so we leave space and copy over */
+ if (strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S.xxxxxx%z", gettime_r(&t, &tm)) <= 0) {
+ log_error("Failed to format ISO-precise time");
+ return -EINVAL;
+ }
+ xsprintf(usec, "%06"PRI_USEC, x % USEC_PER_SEC);
+ memcpy(buf + 20, usec, 6);
+ break;
+
case OUTPUT_SHORT:
case OUTPUT_SHORT_PRECISE:
@@ -949,6 +961,7 @@ static int (*output_funcs[_OUTPUT_MODE_MAX])(
[OUTPUT_SHORT] = output_short,
[OUTPUT_SHORT_ISO] = output_short,
+ [OUTPUT_SHORT_ISO_PRECISE] = output_short,
[OUTPUT_SHORT_PRECISE] = output_short,
[OUTPUT_SHORT_MONOTONIC] = output_short,
[OUTPUT_SHORT_UNIX] = output_short,
diff --git a/src/shared/output-mode.c b/src/shared/output-mode.c
index 67d8208ad2..29dcba9f6b 100644
--- a/src/shared/output-mode.c
+++ b/src/shared/output-mode.c
@@ -24,6 +24,7 @@ static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {
[OUTPUT_SHORT] = "short",
[OUTPUT_SHORT_FULL] = "short-full",
[OUTPUT_SHORT_ISO] = "short-iso",
+ [OUTPUT_SHORT_ISO_PRECISE] = "short-iso-precise",
[OUTPUT_SHORT_PRECISE] = "short-precise",
[OUTPUT_SHORT_MONOTONIC] = "short-monotonic",
[OUTPUT_SHORT_UNIX] = "short-unix",
diff --git a/src/shared/output-mode.h b/src/shared/output-mode.h
index ff29dafcb5..2a1bfd98d0 100644
--- a/src/shared/output-mode.h
+++ b/src/shared/output-mode.h
@@ -25,6 +25,7 @@ typedef enum OutputMode {
OUTPUT_SHORT,
OUTPUT_SHORT_FULL,
OUTPUT_SHORT_ISO,
+ OUTPUT_SHORT_ISO_PRECISE,
OUTPUT_SHORT_PRECISE,
OUTPUT_SHORT_MONOTONIC,
OUTPUT_SHORT_UNIX,
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 64945121f7..8b42a93ba3 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -7001,7 +7001,8 @@ static void systemctl_help(void) {
" --root=PATH Enable unit files in the specified root directory\n"
" -n --lines=INTEGER Number of journal entries to show\n"
" -o --output=STRING Change journal output mode (short, short-precise,\n"
- " short-iso, short-full, short-monotonic, short-unix,\n"
+ " short-iso, short-iso-precise, short-full,\n"
+ " short-monotonic, short-unix,\n"
" verbose, export, json, json-pretty, json-sse, cat)\n"
" --firmware-setup Tell the firmware to show the setup menu on next boot\n"
" --plain Print unit dependencies as a list instead of a tree\n\n"