You are not logged in.

#1 2016-03-03 19:57:45

arcctgx
Member
Registered: 2016-02-28
Posts: 6

[SOLVED] journald timestamp format when using ForwardToConsole

I set up forwarding of journald messages to /dev/tty12 as described here https://wiki.archlinux.org/index.php/sy … ev.2Ftty12

It works, but the timestamps only show the number of seconds since boot:

[ 8019.945016] systemd[1]: Reloading.

On the other hand, when I use journalctl, the output resembles traditional syslog output I'm used to:

mar 03 19:16:17 MyHostname systemd[1]: Reloading.

I am aware that it's possible to use option -o to journalctl to specify the timestamp format. Is it possible to somehow specify the format so that logs forwarded to /dev/tty12 are also affected? I don't see any options that could affect this mentioned in man journald.conf. Without much hope I added

Output=short

to fw-tty12.conf, but it didn't work. I wasn't able to find any useful info on Google.

Last edited by arcctgx (2016-03-03 22:05:17)

Offline

#2 2016-03-03 20:06:15

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: [SOLVED] journald timestamp format when using ForwardToConsole

I have the following /etc/systemd/system/journal@tty12.service:

[Unit]
Description=Journal tail on %I
Documentation=man:journalctl(1)
After=systemd-user-sessions.service systemd-journald.service
ConditionPathExists=/dev/tty0

[Service]
ExecStart=/bin/sh -c "exec /bin/journalctl -af > /dev/%I"
Type=idle
Restart=always
RestartSec=1
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=no
KillMode=process
IgnoreSIGPIPE=no

# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=

[Install]
Alias=getty.target.wants/journal@tty12.service

Enable and start it. Disable forward to tty in /etc/systemd/journald.conf.


Mortuus in anima, curam gero cutis

Offline

#3 2016-03-03 21:38:15

arcctgx
Member
Registered: 2016-02-28
Posts: 6

Re: [SOLVED] journald timestamp format when using ForwardToConsole

Thanks, looks like that's what I wanted.

I don't understand most of it, but trying to figure that out seems to be a good entry point to the world of systemd. smile

How does %I get translated to tty12? The only way I see is by the name of the unit file. Is this correct?

Last edited by arcctgx (2016-03-03 21:42:23)

Offline

#4 2016-03-03 21:51:49

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: [SOLVED] journald timestamp format when using ForwardToConsole

Yes, thus the name of the service file should be the one I suggested.
It is simply an adaptation of a standard getty service.
Not sure why something like this is not provided by systemd.

Last edited by patroclo7 (2016-03-03 21:52:12)


Mortuus in anima, curam gero cutis

Offline

#5 2016-03-03 22:04:56

arcctgx
Member
Registered: 2016-02-28
Posts: 6

Re: [SOLVED] journald timestamp format when using ForwardToConsole

Actually, I'm much more surprised that the configuration options that apply to journalctl command are not available in journald.conf.

Thanks for your time and fast answers, I'm marking thread as solved.

Offline

Board footer

Powered by FluxBB