O
O
Oleg2020-07-11 14:24:33
linux
Oleg, 2020-07-11 14:24:33

Linux - date-time format in logs. How to make the year visible?

In the journalctl log, openvpn.log, I would like to see all the components of the date, and not just the month, day and time, as it is now:

-- Logs begin at Thu 2019-07-11 16:29:29 MSK, end at Sat 2020-07-11 14:09:17 MSK. --
May 09 00:47:05 machine sockd[343]: alert: mother[1/1]: shutting down
May 09 00:47:07 machine kernel: watchdog: watchdog0: watchdog did not stop!
-- Reboot --
Jun 20 11:54:34 machine sockd[345]: alert: mother[1/1]: shutting down
Jun 20 11:54:36 machine kernel: watchdog: watchdog0: watchdog did not stop!

openvpn:
Sat Jul 11 14:08:27 2020 library versions: OpenSSL 1.1.1g  21 Apr 2020, LZO 2.10
Sat Jul 11 14:08:27 2020 Diffie-Hellman initialized with 2048 bit key
Sat Jul 11 14:08:27 2020 CRL: loaded 1 CRLs from file crl.pem
Sat Jul 11 14:08:27 2020 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Sat Jul 11 14:08:27 2020 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Sat Jul 11 14:08:27 2020 TUN/TAP device tun0 opened
Sat Jul 11 14:08:27 2020 TUN/TAP TX queue length set to 100

Google couldn't help. Playing around with locales in /etc/locale.conf didn't help either.
$ cat /etc/locale.conf
LANG=en_US.UTF-8
LANGUAGE=en_US:en_GB:en
LC_COLLATE=C
LC_TIME=en_DK.UTF-8

In Midnight Commander, for example, for those files that were created this year, the year is not displayed, for previous years it is shown.
Please help with the format in the logs. Ideally - "YYYY.MM.DD HH:mm:SS".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-07-11
@Batiskaf_stv

Look at the output options through the -o switch.

-o --output=STRING         Change journal output mode (short, short-precise,
                               short-iso, short-iso-precise, short-full,
                               short-monotonic, short-unix, verbose, export,
                               json, json-pretty, json-sse, cat)

e.g.
journalctl --output=short-iso
produces this format
2018-01-28T18:58:20+0300 ubuntu kernel: BIOS-e820: [mem 0x00000000bfd15000-0x00000000bfd5ffff] ACPI NVS
2018-01-28T18:58:20+0300 ubuntu kernel: BIOS-e820: [mem 0x00000000bfd60000-0x00000000bfd68fff] ACPI data
2018-01-28T18:58:20+0300 ubuntu kernel: BIOS-e820: [mem 0x00000000bfd69000-0x00000000bfd6bfff] ACPI NVS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question