如何将 syslog 从 systemd 记录到虚拟控制台?

如何将 syslog 从 systemd 记录到虚拟控制台?

失败了:

$ cat /etc/systemd/system/[email protected]/override.conf 
[Service]
ExecStart=
ExecStart=-/usr/bin/tail -f /var/log/syslog


Aug  2 11:28:22 darts02 tail[317]: Aug  2 11:28:18 darts02 tail[317]: Aug  2 11:28:15 darts02 tail[317]: rts02 tail[317]: Aug  2 11:27:25 da
Aug  2 11:28:22 darts02 tail[317]: Aug  2 11:28:18 darts02 tail[317]: Aug  2 11:28:15 darts02 tail[317]: Aug  2 11:28:12 darts02 tail[317]: rts02 tail[317]: Aug  2 11:27:25 da
Aug  2 11:28:22 darts02 tail[317]: Aug  2 11:28:18 darts02 tail[317]: Aug  2 11:28:15 darts02 tail[317]: Aug  2 11:28:12 darts02 tail[317]: Aug  2 11:28:10 darts02 tail[317]: rts02 tail[317]: Aug  2 11:27:24 da
Aug  2 11:28:22 darts02 tail[317]: Aug  2 11:28:18 darts02 tail[317]: Aug  2 11:28:15 darts02 tail[317]: Aug  2 11:28:12 darts02 tail[317]: Aug  2 11:28:10 darts02 tail[317]: Aug  2 11:28:08 darts02 tail[317]: rts02 tail[317]: Aug  2 11:27:24 da

在网上找不到任何东西...

答案1

我使用 APT 包 apt://console-log 部分解决了我的问题:

# /etc/console-log.conf -- configuration file for console-log.
# see console-log.conf(5) for details

# works
tty 9
file /var/log/syslog
group adm # needed in debian

# doesn't work as Xorg.log does not exist yet.
tty 8
file /var/log/Xorg.0.log
less_opts "--LONG-PROMPT --chop-long-lines --jump-target=10 --max-forw-scroll=100 --window=-4 --follow-name"

但 less 选项--follow-name不起作用,如下所述: http://manpages.ubuntu.com/manpages/trusty/man5/console-log.conf.5.html

系统日志中没有错误消息。

相关内容